X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fdemos%2FDemoEditorWindow.java;h=87798fb3f4b08d5ca6f684dc44928143f57aa35b;hb=8a1cae77d279cc246a68109f6178b2bb05e7471f;hp=f04916a1df1a933f7ab0f495dfbaae22a631f674;hpb=e8a11f986bfe2556e450d7b8ad6ef0059b369bbc;p=fanfix.git diff --git a/src/jexer/demos/DemoEditorWindow.java b/src/jexer/demos/DemoEditorWindow.java deleted file mode 100644 index f04916a..0000000 --- a/src/jexer/demos/DemoEditorWindow.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Jexer - Java Text User Interface - * - * The MIT License (MIT) - * - * Copyright (C) 2017 Kevin Lamonte - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * @author Kevin Lamonte [kevin.lamonte@gmail.com] - * @version 1 - */ -package jexer.demos; - -import jexer.*; -import jexer.event.*; -import static jexer.TCommand.*; -import static jexer.TKeypress.*; - -/** - * This window demonstates the TText, THScroller, and TVScroller widgets. - */ -public class DemoEditorWindow extends TWindow { - - /** - * Hang onto my TEditor so I can resize it with the window. - */ - private TEditorWidget editField; - - /** - * 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 DemoEditorWindow(final TApplication parent, final String title, - final String text) { - - super(parent, title, 0, 0, 44, 22, RESIZABLE); - editField = addEditor(text, 0, 0, 42, 20); - - statusBar = newStatusBar("Editable text window"); - statusBar.addShortcutKeypress(kbF1, cmHelp, "Help"); - statusBar.addShortcutKeypress(kbF2, cmShell, "Shell"); - statusBar.addShortcutKeypress(kbF3, cmOpen, "Open"); - statusBar.addShortcutKeypress(kbF10, cmExit, "Exit"); - } - - /** - * Public constructor. - * - * @param parent the main application - */ - public DemoEditorWindow(final TApplication parent) { - this(parent, "Editor", -"This is an example of an editable text field. Some example text follows.\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" + -"wishing to use the actual C++ Turbo Vision library, see [Sergio\n" + -"Sigala's updated version](http://tvision.sourceforge.net/) that runs\n" + -"on many more platforms.\n" + -"\n" + -"This library is licensed MIT. See the file LICENSE for the full license\n" + -"for the details.\n" + -"\n" + -"package jexer.demos;\n" + -"\n" + -"import jexer.*;\n" + -"import jexer.event.*;\n" + -"import static jexer.TCommand.*;\n" + -"import static jexer.TKeypress.*;\n" + -"\n" + -"/**\n" + -" * This window demonstates the TText, THScroller, and TVScroller widgets.\n" + -" */\n" + -"public class DemoEditorWindow extends TWindow {\n" + -"\n" + -"1 2 3 123\n" + -"\n" - ); - - } - - /** - * Handle window/screen resize events. - * - * @param event resize event - */ - @Override - public void onResize(final TResizeEvent event) { - if (event.getType() == TResizeEvent.Type.WIDGET) { - // Resize the text field - TResizeEvent editSize = new TResizeEvent(TResizeEvent.Type.WIDGET, - event.getWidth() - 2, event.getHeight() - 2); - editField.onResize(editSize); - return; - } - - // Pass to children instead - for (TWidget widget: getChildren()) { - widget.onResize(event); - } - } - -}