fix parentless commit
authorNiki Roo <niki@nikiroo.be>
Thu, 24 Oct 2019 06:35:32 +0000 (08:35 +0200)
committerNiki Roo <niki@nikiroo.be>
Thu, 24 Oct 2019 06:35:32 +0000 (08:35 +0200)
src/jexer/TWidget.java

index 32b55983613a67914aec832d2d0ac7c6ab323287..f11cbf35c62d3aa53d19040343c47a492109d019 100644 (file)
@@ -208,20 +208,9 @@ public abstract class TWidget implements Comparable<TWidget> {
         }
 
         this.enabled = enabled;
+        this.parent = parent;
         children = new ArrayList<TWidget>();
 
-        // 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<TWidget> {
      */
     private void addChild(final TWidget child) {
         children.add(child);
-        child.parent = this;
-        child.window = this.window;
 
         if ((child.enabled)
             && !(child instanceof THScroller)