X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fdemos%2FDemoTextWindow.java;h=75fd40bd47f69cb969970ea6af7f90bb3b49b1bc;hb=efb7af1f330223bfe9ac67112149d7a3f1b68421;hp=81235cdad2d1b8330dfcc8de0d6602838e2ea42e;hpb=d09767633248d79d1abc85f94d03b4102fae3f64;p=fanfix.git diff --git a/src/jexer/demos/DemoTextWindow.java b/src/jexer/demos/DemoTextWindow.java index 81235cd..75fd40b 100644 --- a/src/jexer/demos/DemoTextWindow.java +++ b/src/jexer/demos/DemoTextWindow.java @@ -44,17 +44,31 @@ public class DemoTextWindow extends TWindow { */ 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" + @@ -62,16 +76,11 @@ public class DemoTextWindow extends TWindow { "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"); + } /** @@ -94,5 +103,24 @@ public class DemoTextWindow extends TWindow { 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); + } + +}