Fix ClassCastException
[fanfix.git] / src / jexer / TWidget.java
index 22766dde5aa281212c320182fbad09f76c9978f6..12e43444a6f085392903d4335fe6004fc72c6194 100644 (file)
@@ -622,7 +622,12 @@ public abstract class TWidget implements Comparable<TWidget> {
         this.parent = parent;
         this.window = parent.window;
         children = new ArrayList<TWidget>();
-        parent.addChild(this);
+
+        // Do not add TStatusBars, they are drawn by TApplication
+        if (this instanceof TStatusBar) {
+        } else {
+            parent.addChild(this);
+        }
     }
 
     /**
@@ -642,7 +647,12 @@ public abstract class TWidget implements Comparable<TWidget> {
         this.parent = parent;
         this.window = parent.window;
         children = new ArrayList<TWidget>();
-        parent.addChild(this);
+
+        // Do not add TStatusBars, they are drawn by TApplication
+        if (this instanceof TStatusBar) {
+        } else {
+            parent.addChild(this);
+        }
 
         this.x = x;
         this.y = y;