$(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 \
$(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)
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
- <property name="demo.class" value="Demo1"/>
-
<target name="clean">
- <delete dir="${build.dir}"/>
+ <delete dir="${build.dir}"/>
</target>
<target name="compile">
- <mkdir dir="${classes.dir}"/>
- <javac srcdir="${src.dir}" destdir="${classes.dir}"
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}"
includeantruntime="false"/>
</target>
<target name="jar" depends="compile">
- <mkdir dir="${jar.dir}"/>
- <jar destfile="${jar.dir}/${ant.project.name}.jar"
- basedir="${classes.dir}"
- excludes="**/Demo*" >
- </jar>
- </target>
-
- <target name="demos" depends="jar">
- <mkdir dir="${classes.dir}"/>
- <javac srcdir="demos" destdir="${classes.dir}"
- includeantruntime="false"/>
+ <mkdir dir="${jar.dir}"/>
+ <jar destfile="${jar.dir}/${ant.project.name}.jar"
+ basedir="${classes.dir}">
+ <manifest>
+ <attribute name="Main-Class" value="jexer.demos.Demo1"/>
+ </manifest>
+ </jar>
</target>
- <target name="run" depends="jar,docs,demos">
- <java classname="${demo.class}" fork="false">
- <classpath>
- <path location="${jar.dir}/${ant.project.name}.jar"/>
- <path location="${classes.dir}"/>
- </classpath>
- </java>
+ <target name="run" depends="jar">
+ <java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
-
+
<target name="docs" depends="jar">
<javadoc
- destdir="docs/api"
- author="true"
- version="true"
- use="true"
+ destdir="docs/api"
+ author="true"
+ version="true"
+ use="true"
access="private"
failonwarning="true"
- windowtitle="Jexer - Java Text User Interface - API docs">
+ windowtitle="Jexer - Java Text User Interface - API docs">
<fileset dir="${src.dir}" defaultexcludes="yes">
<include name="jexer/**"/>
- <exclude name="demos/**"/>
</fileset>
<doctitle>
-->
</javadoc>
</target>
-
+
</project>
-/**
- * Jexer - Java Text User Interface - demonstration program
- *
- * Version: $Id$
- *
- * Author: Kevin Lamonte, <a href="mailto:kevin.lamonte@gmail.com">kevin.lamonte@gmail.com</a>
+/*
+ * 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
*
* 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 {
/**
/**
* 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(
}
}
+/**
+ * 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;
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);
}
}
);
}
+/**
+ * This window demonstates the TMessageBox and TInputBox widgets.
+ */
class DemoMsgBoxWindow extends TWindow {
/*
private void openYNCMessageBox() {
/**
* Constructor.
+ *
+ * @param parent the main application
*/
DemoMsgBoxWindow(final TApplication parent) {
this(parent, TWindow.CENTERED | TWindow.RESIZABLE);
/**
* 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
}
}
-
+/**
+ * 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.
/**
* 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);
class DemoApplication extends TApplication {
/**
- * Public constructor
+ * Public constructor.
+ *
+ * @throws Exception if TApplication can't instantiate the Backend.
*/
public DemoApplication() throws Exception {
super(null, null);
--- /dev/null
+/*
+ * 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;