From: Niki Roo Date: Thu, 24 Oct 2019 06:35:32 +0000 (+0200) Subject: fix parentless commit X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=35b1874b53e81e93aea42f146decc138c71ca0d1;p=fanfix-jexer.git fix parentless commit --- diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index 32b5598..f11cbf3 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -208,20 +208,9 @@ public abstract class TWidget implements Comparable { } this.enabled = enabled; + this.parent = parent; children = new ArrayList(); - // Allow parentless widgets - if (parent != null) { - // Do not add TStatusBars, they are drawn by TApplication. - if (this instanceof TStatusBar) { - // We don't add the child to the children list here - this.parent = parent; - this.window = parent.window; - } else { - parent.addChild(this); - } - } - this.x = x; this.y = y; this.width = width; @@ -1375,8 +1364,6 @@ public abstract class TWidget implements Comparable { */ private void addChild(final TWidget child) { children.add(child); - child.parent = this; - child.window = this.window; if ((child.enabled) && !(child instanceof THScroller)