From: Kevin Lamonte Date: Sun, 15 Mar 2015 18:02:37 +0000 (-0400) Subject: Pull demo into jar X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=70f5b2bbcbac3df8bf855895ff51d63a5e9d333c;p=nikiroo-utils.git Pull demo into jar --- diff --git a/Makefile b/Makefile index 63c74ec..8a3c72e 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,8 @@ JEXER_SRC = $(SRC_DIR)/jexer/TApplication.java \ $(SRC_DIR)/jexer/io/ECMA48Screen.java \ $(SRC_DIR)/jexer/io/ECMA48Terminal.java \ $(SRC_DIR)/jexer/backend/Backend.java \ - $(SRC_DIR)/jexer/backend/ECMA48Backend.java + $(SRC_DIR)/jexer/backend/ECMA48Backend.java \ + $(SRC_DIR)/jexer/demos/Demo1.java JEXER_BIN = $(TARGET_DIR)/jexer/TApplication.class \ $(TARGET_DIR)/jexer/TAction.class \ @@ -106,30 +107,25 @@ JEXER_BIN = $(TARGET_DIR)/jexer/TApplication.class \ $(TARGET_DIR)/jexer/io/ECMA48Screen.class \ $(TARGET_DIR)/jexer/io/ECMA48Terminal.class \ $(TARGET_DIR)/jexer/backend/Backend.class \ - $(TARGET_DIR)/jexer/backend/ECMA48Backend.class + $(TARGET_DIR)/jexer/backend/ECMA48Backend.class \ + $(TARGET_DIR)/jexer/demos/Demo1.class JAVAC = javac JAVAFLAGS = -g -deprecation -all: jexer demos +all: jexer run: jexer run-demo1 -all-demos: jexer demos/Demo1.class +all-demos: jexer -demos/Demo1.class: demos/Demo1.java - $(JAVAC) $(JAVAFLAGS) -cp $(TARGET_DIR) -d demos demos/Demo1.java +run-demo1: all-demos + java -cp $(TARGET_DIR) jexer.demos.Demo1 -run-demo1: demos/Demo1.class - java -cp $(TARGET_DIR):demos Demo1 - -clean: clean-demos +clean: -rm -r $(ANT_TARGET_DIR) -rm -r $(TARGET_DIR) -mkdir $(TARGET_DIR) -clean-demos: - -rm demos/Demo1.class - jexer: $(JEXER_SRC) $(JAVAC) $(JAVAFLAGS) -sourcepath $(SRC_DIR) -d $(TARGET_DIR) $(JEXER_SRC) diff --git a/README.md b/README.md index 48d1bff..e2af305 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Many tasks remain before calling this version 1.0: 0.0.1: - TMessageBox +- TInputBox - AWTBackend 0.0.2: @@ -75,6 +76,7 @@ Many tasks remain before calling this version 1.0: 0.0.4: - Bugs + - Bare ESC isn't being returned immediately - TTimer is jittery with I/O - TSubMenu keyboard mnemonic not working - kbDel assertion failure in TMenu (MID_CLEAR) diff --git a/build.xml b/build.xml index 06733d7..e9d3555 100644 --- a/build.xml +++ b/build.xml @@ -35,58 +35,46 @@ - - - + - - + - - - - - - - - + + + + + + - - - - - - - + + - + + windowtitle="Jexer - Java Text User Interface - API docs"> - @@ -106,5 +94,5 @@ --> - + diff --git a/demos/Demo1.java b/src/jexer/demos/Demo1.java similarity index 86% rename from demos/Demo1.java rename to src/jexer/demos/Demo1.java index a179b07..1e482d4 100644 --- a/demos/Demo1.java +++ b/src/jexer/demos/Demo1.java @@ -1,16 +1,11 @@ -/** - * Jexer - Java Text User Interface - demonstration program - * - * Version: $Id$ - * - * Author: Kevin Lamonte, kevin.lamonte@gmail.com +/* + * Jexer - Java Text User Interface * * License: LGPLv3 or later * - * Copyright: This module is licensed under the GNU Lesser General - * Public License Version 3. Please see the file "COPYING" in this - * directory for more information about the GNU Lesser General Public - * License Version 3. + * This module is licensed under the GNU Lesser General Public License + * Version 3. Please see the file "COPYING" in this directory for more + * information about the GNU Lesser General Public License Version 3. * * Copyright (C) 2015 Kevin Lamonte * @@ -29,12 +24,19 @@ * http://www.gnu.org/licenses/, or write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA + * + * @author Kevin Lamonte [kevin.lamonte@gmail.com] + * @version 1 */ +package jexer.demos; import jexer.*; import jexer.event.*; import jexer.menu.*; +/** + * This window demonstates the TText, THScroller, and TVScroller widgets. + */ class DemoTextWindow extends TWindow { /** @@ -44,8 +46,10 @@ class DemoTextWindow extends TWindow { /** * Public constructor. + * + * @param parent the main application */ - public DemoTextWindow(TApplication parent) { + public DemoTextWindow(final TApplication parent) { super(parent, "Text Areas", 0, 0, 44, 20, RESIZABLE); textField = addText( @@ -92,21 +96,30 @@ class DemoTextWindow extends TWindow { } } +/** + * This window demonstates the TRadioGroup, TRadioButton, and TCheckbox + * widgets. + */ class DemoCheckboxWindow extends TWindow { /** * Constructor. + * + * @param parent the main application */ - DemoCheckboxWindow(TApplication parent) { + DemoCheckboxWindow(final TApplication parent) { this(parent, CENTERED | RESIZABLE); } /** * Constructor. + * + * @param parent the main application + * @param flags bitmask of MODAL, CENTERED, or RESIZABLE */ - DemoCheckboxWindow(TApplication parent, int flags) { - // Construct a demo window. X and Y don't matter because it - // will be centered on screen. + DemoCheckboxWindow(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, "Radiobuttons and Checkboxes", 0, 0, 60, 15, flags); int row = 1; @@ -126,7 +139,8 @@ class DemoCheckboxWindow extends TWindow { addButton("&Close Window", (getWidth() - 14) / 2, getHeight() - 4, new TAction() { public void DO() { - DemoCheckboxWindow.this.getApplication().closeWindow(DemoCheckboxWindow.this); + DemoCheckboxWindow.this.getApplication() + .closeWindow(DemoCheckboxWindow.this); } } ); @@ -135,6 +149,9 @@ class DemoCheckboxWindow extends TWindow { } +/** + * This window demonstates the TMessageBox and TInputBox widgets. + */ class DemoMsgBoxWindow extends TWindow { /* private void openYNCMessageBox() { @@ -198,6 +215,8 @@ EOS", /** * Constructor. + * + * @param parent the main application */ DemoMsgBoxWindow(final TApplication parent) { this(parent, TWindow.CENTERED | TWindow.RESIZABLE); @@ -205,6 +224,9 @@ EOS", /** * Constructor. + * + * @param parent the main application + * @param flags bitmask of MODAL, CENTERED, or RESIZABLE */ DemoMsgBoxWindow(final TApplication parent, final int flags) { // Construct a demo window. X and Y don't matter because it @@ -253,7 +275,10 @@ EOS", } } - +/** + * This is the main "demo" application window. It makes use of the TTimer, + * TProgressBox, TLabel, TButton, and TField widgets. + */ class DemoMainWindow extends TWindow { // Timer that increments a number. @@ -292,18 +317,25 @@ class DemoMainWindow extends TWindow { /** * Construct demo window. It will be centered on screen. + * + * @param parent the main application */ - public DemoMainWindow(TApplication parent) { + public DemoMainWindow(final TApplication parent) { this(parent, CENTERED | RESIZABLE); } + // These are used by the timer loop. They have to be at class scope so + // that they can be accessed by the anonymous TAction class. int timerI = 0; TProgressBar progressBar; /** * Constructor. + * + * @param parent the main application + * @param flags bitmask of MODAL, CENTERED, or RESIZABLE */ - private DemoMainWindow(TApplication parent, int flags) { + 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, "Demo Window", 0, 0, 60, 23, flags); @@ -425,7 +457,9 @@ class DemoMainWindow extends TWindow { class DemoApplication extends TApplication { /** - * Public constructor + * Public constructor. + * + * @throws Exception if TApplication can't instantiate the Backend. */ public DemoApplication() throws Exception { super(null, null); diff --git a/src/jexer/demos/package-info.java b/src/jexer/demos/package-info.java new file mode 100644 index 0000000..852ea69 --- /dev/null +++ b/src/jexer/demos/package-info.java @@ -0,0 +1,35 @@ +/* + * Jexer - Java Text User Interface + * + * License: LGPLv3 or later + * + * This module is licensed under the GNU Lesser General Public License + * Version 3. Please see the file "COPYING" in this directory for more + * information about the GNU Lesser General Public License Version 3. + * + * Copyright (C) 2015 Kevin Lamonte + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, see + * http://www.gnu.org/licenses/, or write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + * @author Kevin Lamonte [kevin.lamonte@gmail.com] + * @version 1 + */ + +/** + * Demonstration programs. + */ +package jexer.demos;