Rearrange to fit
authorKevin Lamonte <Kevin.Lamonte@honeywell.com>
Wed, 20 Mar 2019 18:47:31 +0000 (13:47 -0500)
committerKevin Lamonte <Kevin.Lamonte@honeywell.com>
Wed, 20 Mar 2019 18:47:31 +0000 (13:47 -0500)
src/jexer/demos/DemoMainWindow.java
src/jexer/demos/DemoMainWindow.properties
src/jexer/demos/DemoTextFieldWindow.java

index 5433d44924006ccdfad3b59e4ee96da9f41c9dc2..c5e599c53bcebade57dbe95ff13e1786d256d4b9 100644 (file)
@@ -31,9 +31,6 @@ package jexer.demos;
 import java.io.File;
 import java.io.IOException;
 import java.text.MessageFormat;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.Locale;
 import java.util.ResourceBundle;
 
 import jexer.TAction;
@@ -87,17 +84,6 @@ public class DemoMainWindow extends TWindow {
      */
     TProgressBar progressBar;
 
-    /**
-     * Day of week label is updated with TSpinner clicks.
-     */
-    TLabel dayOfWeekLabel;
-
-    /**
-     * Day of week to demonstrate TSpinner.  Has to be at class scope so that
-     * it can be accessed by the anonymous TAction class.
-     */
-    GregorianCalendar calendar = new GregorianCalendar();
-
     // ------------------------------------------------------------------------
     // Constructors -----------------------------------------------------------
     // ------------------------------------------------------------------------
@@ -120,7 +106,7 @@ public class DemoMainWindow extends TWindow {
     private DemoMainWindow(final TApplication parent, final int flags) {
         // Construct a demo window.  X and Y don't matter because it will be
         // centered on screen.
-        super(parent, i18n.getString("windowTitle"), 0, 0, 64, 25, flags);
+        super(parent, i18n.getString("windowTitle"), 0, 0, 64, 23, flags);
 
         int row = 1;
 
@@ -242,11 +228,11 @@ public class DemoMainWindow extends TWindow {
                 }
             }
         );
-        row += 2;
 
-        progressBar = addProgressBar(1, row, 22, 0);
+        row = 15;
+        progressBar = addProgressBar(48, row, 12, 0);
         row++;
-        timerLabel = addLabel(i18n.getString("timerLabel"), 1, row);
+        timerLabel = addLabel(i18n.getString("timerLabel"), 48, row);
         timer = getApplication().addTimer(250, true,
             new TAction() {
 
@@ -264,33 +250,6 @@ public class DemoMainWindow extends TWindow {
             }
         );
 
-        dayOfWeekLabel = addLabel("Wednesday-", 35, row - 1, "tmenu", false);
-        dayOfWeekLabel.setLabel(String.format("%-10s",
-                calendar.getDisplayName(Calendar.DAY_OF_WEEK,
-                    Calendar.LONG, Locale.getDefault())));
-
-        addSpinner(35 + dayOfWeekLabel.getWidth(), row - 1,
-            new TAction() {
-                public void DO() {
-                    calendar.add(Calendar.DAY_OF_WEEK, 1);
-                    dayOfWeekLabel.setLabel(String.format("%-10s",
-                            calendar.getDisplayName(
-                            Calendar.DAY_OF_WEEK, Calendar.LONG,
-                            Locale.getDefault())));
-                }
-            },
-            new TAction() {
-                public void DO() {
-                    calendar.add(Calendar.DAY_OF_WEEK, -1);
-                    dayOfWeekLabel.setLabel(String.format("%-10s",
-                            calendar.getDisplayName(
-                            Calendar.DAY_OF_WEEK, Calendar.LONG,
-                            Locale.getDefault())));
-                }
-            }
-        );
-
-
         activate(first);
 
         statusBar = newStatusBar(i18n.getString("statusBar"));
index 31f276ca43af96cceda23faac6e1f9d6d80573dd..25e73334425c01abe6f9c34388c1ba90f7e51d35 100644 (file)
@@ -9,15 +9,15 @@ statusBarExit=Exit
 messageBoxLabel=Message Boxes
 messageBoxButton=&MessageBoxes
 openModalLabel=Open me as modal
-openModalButton=W&indow
-textFieldLabel=Text fields and calendar
+openModalButton=M&odal
+textFieldLabel=Text fields, calendar, spinner
 textFieldButton=Field&s
-radioButtonLabel=Radio buttons, check and combobox
+radioButtonLabel=Radio buttons, checkbox, combobox
 radioButtonButton=&CheckBoxes
 editorLabel=Editor window
 editorButton1=&1 Widget
 editorButton2=&2 Window
-ttableLabel=TTable
+ttableLabel=Editable Table
 ttableButton1=&3 Widget
 ttableButton2=&4 Window
 textAreaLabel=Text areas
index 196f3b9c3fa7f8b137d1428438e119a122681316..7eb68d6a0c9d58300fcafbc8962800b6ee252b2a 100644 (file)
 package jexer.demos;
 
 import java.text.MessageFormat;
+import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
 import java.util.ResourceBundle;
 
 import jexer.TAction;
 import jexer.TApplication;
 import jexer.TCalendar;
 import jexer.TField;
+import jexer.TLabel;
 import jexer.TMessageBox;
 import jexer.TWindow;
 import static jexer.TCommand.*;
@@ -61,6 +65,17 @@ public class DemoTextFieldWindow extends TWindow {
      */
     TCalendar calendar = null;
 
+    /**
+     * Day of week label is updated with TSpinner clicks.
+     */
+    TLabel dayOfWeekLabel;
+
+    /**
+     * Day of week to demonstrate TSpinner.  Has to be at class scope so that
+     * it can be accessed by the anonymous TAction class.
+     */
+    GregorianCalendar dayOfWeekCalendar = new GregorianCalendar();
+
     // ------------------------------------------------------------------------
     // Constructors -----------------------------------------------------------
     // ------------------------------------------------------------------------
@@ -111,6 +126,33 @@ public class DemoTextFieldWindow extends TWindow {
             }
         );
 
+        dayOfWeekLabel = addLabel("Wednesday-", 35, row - 1, "tmenu", false);
+        dayOfWeekLabel.setLabel(String.format("%-10s",
+                dayOfWeekCalendar.getDisplayName(Calendar.DAY_OF_WEEK,
+                    Calendar.LONG, Locale.getDefault())));
+
+        addSpinner(35 + dayOfWeekLabel.getWidth(), row - 1,
+            new TAction() {
+                public void DO() {
+                    dayOfWeekCalendar.add(Calendar.DAY_OF_WEEK, 1);
+                    dayOfWeekLabel.setLabel(String.format("%-10s",
+                            dayOfWeekCalendar.getDisplayName(
+                            Calendar.DAY_OF_WEEK, Calendar.LONG,
+                            Locale.getDefault())));
+                }
+            },
+            new TAction() {
+                public void DO() {
+                    dayOfWeekCalendar.add(Calendar.DAY_OF_WEEK, -1);
+                    dayOfWeekLabel.setLabel(String.format("%-10s",
+                            dayOfWeekCalendar.getDisplayName(
+                            Calendar.DAY_OF_WEEK, Calendar.LONG,
+                            Locale.getDefault())));
+                }
+            }
+        );
+
+
         addButton(i18n.getString("closeWindow"),
             (getWidth() - 14) / 2, getHeight() - 4,
             new TAction() {