Package jexer.demos

Class DemoApplication

  • All Implemented Interfaces:
    java.lang.Runnable

    public class DemoApplication
    extends TApplication
    The demo application itself.
    • Constructor Detail

      • DemoApplication

        public DemoApplication​(java.io.InputStream input,
                               java.io.OutputStream output)
                        throws java.io.UnsupportedEncodingException
        Public constructor.
        Parameters:
        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.
        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:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • DemoApplication

        public DemoApplication​(java.io.InputStream input,
                               java.io.Reader reader,
                               java.io.PrintWriter writer,
                               boolean setRawMode)
        Public constructor.
        Parameters:
        input - the InputStream underlying 'reader'. Its available() method is used to determine if reader.read() will block or not.
        reader - a Reader connected to the remote user.
        writer - a PrintWriter connected to the remote user.
        setRawMode - if true, set System.in into raw mode with stty. This should in general not be used. It is here solely for Demo3, which uses System.in.
        Throws:
        java.lang.IllegalArgumentException - if input, reader, or writer are null.
      • DemoApplication

        public DemoApplication​(java.io.InputStream input,
                               java.io.Reader reader,
                               java.io.PrintWriter writer)
        Public constructor.
        Parameters:
        input - the InputStream underlying 'reader'. Its available() method is used to determine if reader.read() will block or not.
        reader - a Reader connected to the remote user.
        writer - a PrintWriter connected to the remote user.
        Throws:
        java.lang.IllegalArgumentException - if input, reader, or writer are null.
      • DemoApplication

        public DemoApplication​(Backend backend)
        Public constructor.
        Parameters:
        backend - a Backend that is already ready to go.
      • DemoApplication

        public DemoApplication​(TApplication.BackendType backendType)
                        throws java.lang.Exception
        Public constructor.
        Parameters:
        backendType - one of the TApplication.BackendType values
        Throws:
        java.lang.Exception - if TApplication can't instantiate the Backend.
    • Method Detail

      • onMenu

        public boolean onMenu​(TMenuEvent menu)
        Handle menu events.
        Overrides:
        onMenu in class TApplication
        Parameters:
        menu - menu event
        Returns:
        if true, the event was processed and should not be passed onto a window