/**
* This window demonstates the TText, THScroller, and TVScroller widgets.
*/
-class DemoTextWindow extends TWindow {
+public class DemoTextWindow extends TWindow {
/**
* Hang onto my TText so I can resize it with the window.
*/
private TText textField;
+ /**
+ * Public constructor makes a text window out of any string.
+ *
+ * @param parent the main application
+ * @param title the text string
+ * @param text the text string
+ */
+ public DemoTextWindow(final TApplication parent, final String title,
+ final String text) {
+
+ super(parent, title, 0, 0, 44, 20, RESIZABLE);
+ textField = addText(text, 1, 1, 40, 16);
+ }
+
/**
* Public constructor.
*
* @param parent the main application
*/
public DemoTextWindow(final TApplication parent) {
- super(parent, "Text Areas", 0, 0, 44, 20, RESIZABLE);
-
- textField = addText(
+ this(parent, "Text Area",
"This is an example of a reflowable text field. Some example text follows.\n" +
"\n" +
+"Notice that some menu items should be disabled when this window has focus.\n" +
+"\n" +
"This library implements a text-based windowing system loosely\n" +
"reminiscient of Borland's [Turbo\n" +
"Vision](http://en.wikipedia.org/wiki/Turbo_Vision) library. For those\n" +
"Sigala's updated version](http://tvision.sourceforge.net/) that runs\n" +
"on many more platforms.\n" +
"\n" +
-"Currently the only console platform supported is Posix (tested on\n" +
-"Linux). Input/output is handled through terminal escape sequences\n" +
-"generated by the library itself: ncurses is not required or linked to. \n" +
-"xterm mouse tracking using UTF8 coordinates is supported.\n" +
-"\n" +
"This library is licensed LGPL (\"GNU Lesser General Public License\")\n" +
"version 3 or greater. See the file COPYING for the full license text,\n" +
"which includes both the GPL v3 and the LGPL supplemental terms.\n" +
-"\n",
- 1, 1, 40, 16);
+"\n");
+
}
/**
widget.onResize(event);
}
}
-}
+ /**
+ * Play with menu items.
+ */
+ public void onFocus() {
+ getApplication().enableMenuItem(2001);
+ getApplication().disableMenuItem(TMenu.MID_SHELL);
+ getApplication().disableMenuItem(TMenu.MID_EXIT);
+ }
+
+ /**
+ * Called by application.switchWindow() when another window gets the
+ * focus.
+ */
+ public void onUnfocus() {
+ getApplication().disableMenuItem(2001);
+ getApplication().enableMenuItem(TMenu.MID_SHELL);
+ getApplication().enableMenuItem(TMenu.MID_EXIT);
+ }
+
+}