stubs for TFileOpenBox, cleanup putStringXY
[fanfix.git] / src / jexer / demos / DemoApplication.java
index 4c5ba319cc97669a7bee02c2e93408017bc83188..95d0a54f81d4c8e1fe9b781fcf02a07e81f32e51 100644 (file)
  */
 package jexer.demos;
 
+import java.io.*;
+
 import jexer.*;
-import jexer.event.*;
 import jexer.menu.*;
 
 /**
  * The demo application itself.
  */
-class DemoApplication extends TApplication {
+public class DemoApplication extends TApplication {
 
     /**
-     * Public constructor.
-     *
-     * @param backendType one of the TApplication.BackendType values
-     * @throws Exception if TApplication can't instantiate the Backend.
+     * Add all the widgets of the demo.
      */
-    public DemoApplication(BackendType backendType) throws Exception {
-        super(backendType);
+    private void addAllWidgets() {
         new DemoMainWindow(this);
 
         // Add the menus
@@ -76,6 +73,35 @@ class DemoApplication extends TApplication {
         item = subMenu.addItem(2002, "&Normal (sub)");
 
         addWindowMenu();
-
+    }
+    
+    /**
+     * Public constructor.
+     *
+     * @param input an InputStream connected to the remote user, or null for
+     * System.in.  If System.in is used, then on non-Windows systems it will
+     * be put in raw mode; shutdown() will (blindly!) put System.in in cooked
+     * mode.  input is always converted to a Reader with UTF-8 encoding.
+     * @param output an OutputStream connected to the remote user, or null
+     * for System.out.  output is always converted to a Writer with UTF-8
+     * encoding.
+     * @throws UnsupportedEncodingException if an exception is thrown when
+     * creating the InputStreamReader
+     */
+    public DemoApplication(final InputStream input,
+        final OutputStream output) throws UnsupportedEncodingException {
+        super(input, output);
+        addAllWidgets();
+    }
+    
+    /**
+     * Public constructor.
+     *
+     * @param backendType one of the TApplication.BackendType values
+     * @throws Exception if TApplication can't instantiate the Backend.
+     */
+    public DemoApplication(BackendType backendType) throws Exception {
+        super(backendType);
+        addAllWidgets();
     }
 }