Fix ClassCastException
authorKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 20 Aug 2017 20:44:35 +0000 (16:44 -0400)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 20 Aug 2017 20:44:35 +0000 (16:44 -0400)
src/jexer/TApplication.java
src/jexer/TWidget.java
src/jexer/menu/TMenu.java
src/jexer/menu/TMenu.properties

index 57d60955e33a1f1d4b21a2069e8b930c922d0124..66f711017604bfb1f37b89fb5ad91612ec4eee78 100644 (file)
@@ -2512,6 +2512,10 @@ public class TApplication implements Runnable {
             showAboutDialog();
             return true;
         }
+        if (menu.getId() == TMenu.MID_REPAINT) {
+            doRepaint();
+            return true;
+        }
         return false;
     }
 
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;
index 0e948cee0df2fbb7845a53bcf76e6a64074da37e..c4a11df23d6f38b51aa071be0dbd4ff93cf10e7d 100644 (file)
@@ -104,6 +104,9 @@ public final class TMenu extends TWindow {
     public static final int MID_HELP_ACTIVE_FILE        = 45;
     public static final int MID_ABOUT                   = 46;
 
+    // Other
+    public static final int MID_REPAINT         = 50;
+
     /**
      * Public constructor.
      *
@@ -477,6 +480,10 @@ public final class TMenu extends TWindow {
             label = i18n.getString("menuHelpAbout");
             break;
 
+        case MID_REPAINT:
+            label = i18n.getString("menuRepaintDesktop");
+            break;
+
         default:
             throw new IllegalArgumentException("Invalid menu ID: " + id);
         }
index bf3b4f3dad91fc2ffca0f21629ea136bf065f2d3..000df917d26052a345b5d7ad9e4973114e350a71 100644 (file)
@@ -20,3 +20,5 @@ menuHelpPrevious=&Previous topic
 menuHelpHelp=&Help on help
 menuHelpActive=Active &file...
 menuHelpAbout=&About...
+
+menuRepaintDesktop=&Repaint desktop