Package jexer

Class TApplication

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    DemoApplication, DesktopDemoApplication, XTWMApplication

    public class TApplication
    extends java.lang.Object
    implements java.lang.Runnable
    TApplication is the main driver class for a full Text User Interface application. It manages windows, provides a menu bar and status bar, and processes events received from the user.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TApplication.BackendType
      Two backend types are available.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean desktopCanHaveCursor
      If true, the desktop can have the cursor blinking/visible even if the top-most window does not have the cursor active.
      protected HelpFile helpFile
      The help file data.
      protected java.util.ArrayList<Topic> helpTopics
      The stack of help topics.
      static boolean imageSupportTest
      If true, do not confirm on exit, and leave the terminal in its final state (do not restore the console).
      protected long lastUserInputTime
      The last time user input (mouse or keyboard) was received.
      protected java.lang.String menuTrayText
      Optional text to display at the top right of the menu.
      protected boolean smartWindowPlacement
      If true, do "smart placement" on new windows that are not specified to be centered.
      protected boolean textMouse
      If true, display a text-based mouse cursor.
    • Constructor Summary

      Constructors 
      Constructor Description
      TApplication​(java.io.InputStream input, java.io.OutputStream output)
      Public constructor.
      TApplication​(java.io.InputStream input, java.io.Reader reader, java.io.PrintWriter writer)
      Public constructor.
      TApplication​(java.io.InputStream input, java.io.Reader reader, java.io.PrintWriter writer, boolean setRawMode)
      Public constructor.
      TApplication​(Backend backend)
      Public constructor.
      TApplication​(TApplication.BackendType backendType)
      Public constructor.
      TApplication​(TApplication.BackendType backendType, int windowWidth, int windowHeight, int fontSize)
      Public constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activateWindow​(TWindow window)
      Activate a window: bring it to the top and have it receive events.
      TMenu addEditMenu()
      Convenience function to add a default "Edit" menu.
      TMenu addFileMenu()
      Convenience function to add a default "File" menu.
      TMenu addHelpMenu()
      Convenience function to add a default "Help" menu.
      TMenu addMenu​(java.lang.String title)
      Convenience function to add a top-level menu.
      void addMenu​(TMenu menu)
      Add a top-level menu to the list.
      void addMenuItem​(TMenuItem item)
      Add a menu item to the global list.
      void addSubMenu​(TMenu menu)
      Add a sub-menu to the list of open sub-menus.
      TMenu addTableMenu()
      Convenience function to add a default "Table" menu.
      TTimer addTimer​(long duration, boolean recurring, TAction action)
      Convenience function to add a timer.
      TMenu addToolMenu()
      Convenience function to add a default tools (hamburger) menu.
      TWindow addWindow​(java.lang.String title, int width, int height)
      Convenience function to create a new window and make it active.
      TWindow addWindow​(java.lang.String title, int width, int height, int flags)
      Convenience function to create a new window and make it active.
      TWindow addWindow​(java.lang.String title, int x, int y, int width, int height)
      Convenience function to create a new window and make it active.
      TWindow addWindow​(java.lang.String title, int x, int y, int width, int height, int flags)
      Convenience function to create a new window and make it active.
      TMenu addWindowMenu()
      Convenience function to add a default "Window" menu.
      void closeMenu()
      Turn off the menu.
      void closeSubMenu()
      Turn off a sub-menu.
      void closeWindow​(TWindow window)
      Close window.
      void disableMenuItem​(int id)
      Disable one menu item.
      void disableMenuItems​(int lower, int upper)
      Disable the range of menu items with ID's between lower and upper, inclusive.
      void doRepaint()
      Repaint the screen on the next update.
      void doSmartPlacement​(TWindow window)
      Place a window to minimize its overlap with other windows.
      void enableMenuItem​(int id)
      Enable one menu item.
      void enableMenuItems​(int lower, int upper)
      Enable the range of menu items with ID's between lower and upper, inclusive.
      void enableSecondaryEventReceiver​(TWidget widget)
      Enable a widget to override the primary event thread.
      void exit()
      Force this application to exit.
      java.lang.String fileOpenBox​(java.lang.String path)
      Convenience function to spawn an file open box.
      java.lang.String fileOpenBox​(java.lang.String path, TFileOpenBox.Type type)
      Convenience function to spawn an file open box.
      java.lang.String fileOpenBox​(java.lang.String path, TFileOpenBox.Type type, java.lang.String filter)
      Convenience function to spawn a file open box.
      java.lang.String fileOpenBox​(java.lang.String path, TFileOpenBox.Type type, java.util.List<java.lang.String> filters)
      Convenience function to spawn a file open box.
      java.lang.String fileSaveBox​(java.lang.String path)
      Convenience function to spawn a file save box.
      TWindow getActiveWindow()
      Get the current active window.
      java.util.List<TMenu> getAllMenus()
      Get a (shallow) copy of the menu list.
      java.util.List<TWindow> getAllWindows()
      Get a (shallow) copy of the window list.
      Backend getBackend()
      Get the Backend.
      Clipboard getClipboard()
      Get the clipboard.
      TDesktop getDesktop()
      Get the TDesktop instance.
      int getDesktopBottom()
      Get Y coordinate of the bottom edge of the desktop.
      int getDesktopTop()
      Get Y coordinate of the top edge of the desktop.
      boolean getFocusFollowsMouse()
      Get focusFollowsMouse flag.
      TMenuItem getMenuItem​(int id)
      Get the menu item associated with this ID.
      Screen getScreen()
      Get the Screen.
      ColorTheme getTheme()
      Get the color theme.
      boolean hasWindow​(TWindow window)
      Check if a window instance is in this application's window list.
      int hiddenWindowCount()
      Return the number of windows that are hidden.
      void hideWindow​(TWindow window)
      Hide a window.
      TInputBox inputBox​(java.lang.String title, java.lang.String caption)
      Convenience function to spawn an input box.
      TInputBox inputBox​(java.lang.String title, java.lang.String caption, java.lang.String text)
      Convenience function to spawn an input box.
      TInputBox inputBox​(java.lang.String title, java.lang.String caption, java.lang.String text, TMessageBox.Type type)
      Convenience function to spawn an input box.
      void invokeLater​(java.lang.Runnable command)
      Place a command on the run queue, and run it before the next round of checking I/O.
      boolean isModalThreadRunning()
      Check if a system-wide modal thread is running.
      boolean isRunning()
      Check if application is still running.
      TMessageBox messageBox​(java.lang.String title, java.lang.String caption)
      Convenience function to spawn a message box.
      TMessageBox messageBox​(java.lang.String title, java.lang.String caption, TMessageBox.Type type)
      Convenience function to spawn a message box.
      protected boolean onCommand​(TCommandEvent command)
      Method that TApplication subclasses can override to handle menu or posted command events.
      void onExit()
      Subclasses can use this hook to cleanup resources.
      protected boolean onKeypress​(TKeypressEvent keypress)
      Method that TApplication subclasses can override to handle keystrokes.
      protected boolean onMenu​(TMenuEvent menu)
      Method that TApplication subclasses can override to handle menu events.
      protected void onPostDraw()
      Function called immediately after the screen is drawn, while the screen is still synchronized/locked.
      protected void onPreDraw()
      Function called immediately before the screen is drawn.
      void openContextMenu​(TMenu menu, int x, int y)
      Open a previously created menu as a context menu at a specific location.
      TTerminalWindow openTerminal​(int x, int y)
      Convenience function to open a terminal window.
      TTerminalWindow openTerminal​(int x, int y, boolean closeOnExit)
      Convenience function to open a terminal window.
      TTerminalWindow openTerminal​(int x, int y, int flags)
      Convenience function to open a terminal window.
      TTerminalWindow openTerminal​(int x, int y, int flags, boolean closeOnExit)
      Convenience function to open a terminal window.
      TTerminalWindow openTerminal​(int x, int y, int flags, java.lang.String commandLine)
      Convenience function to open a terminal window and execute a custom command line inside it.
      TTerminalWindow openTerminal​(int x, int y, int flags, java.lang.String[] command)
      Convenience function to open a terminal window and execute a custom command line inside it.
      TTerminalWindow openTerminal​(int x, int y, int flags, java.lang.String[] command, boolean closeOnExit)
      Convenience function to open a terminal window and execute a custom command line inside it.
      TTerminalWindow openTerminal​(int x, int y, int flags, java.lang.String commandLine, boolean closeOnExit)
      Convenience function to open a terminal window and execute a custom command line inside it.
      TTerminalWindow openTerminal​(int x, int y, java.lang.String commandLine)
      Convenience function to open a terminal window and execute a custom command line inside it.
      TTerminalWindow openTerminal​(int x, int y, java.lang.String commandLine, boolean closeOnExit)
      Convenience function to open a terminal window and execute a custom command line inside it.
      void postEvent​(TInputEvent event)
      Post an event to process.
      void postMenuEvent​(TInputEvent event)
      Post an event to process and turn off the menu.
      void recomputeMenuX()
      Recompute menu x positions based on their title length.
      void removeMenu​(TMenu menu)
      Remove a top-level menu from the list.
      void removeTimer​(TTimer timer)
      Convenience function to remove a timer.
      void restoreConsole()
      Restore the console to sane defaults.
      void run()
      Run this application until it exits.
      void setDesktop​(TDesktop desktop)
      Set the TDesktop instance.
      void setDesktop​(TDesktop desktop, boolean close)
      Set the TDesktop instance.
      void setFocusFollowsMouse​(boolean focusFollowsMouse)
      Set focusFollowsMouse flag.
      void setHideMenuBar​(boolean hideMenuBar)
      Set hideMenuBar flag.
      void setHideStatusBar​(boolean hideStatusBar)
      Set hideStatusBar flag.
      protected void showAboutDialog()
      Display the about dialog.
      int shownWindowCount()
      Return the number of windows that are showing.
      void showWindow​(TWindow window)
      Show a window.
      void switchMenu​(boolean forward)
      Switch to the next menu.
      void switchWindow​(boolean forward)
      Switch to the next window.
      int windowCount()
      Return the total number of windows.
      void yield()
      Yield to the secondary thread.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • imageSupportTest

        public static final boolean imageSupportTest
        If true, do not confirm on exit, and leave the terminal in its final state (do not restore the console). This is used for generating captures to test terminals that advertise images support.
        See Also:
        Constant Field Values
      • smartWindowPlacement

        protected boolean smartWindowPlacement
        If true, do "smart placement" on new windows that are not specified to be centered.
      • textMouse

        protected boolean textMouse
        If true, display a text-based mouse cursor.
      • desktopCanHaveCursor

        protected boolean desktopCanHaveCursor
        If true, the desktop can have the cursor blinking/visible even if the top-most window does not have the cursor active. This can lead to a visible artifact where the desktop's cursor is "showing through" a window over it.
      • menuTrayText

        protected java.lang.String menuTrayText
        Optional text to display at the top right of the menu.
      • helpFile

        protected HelpFile helpFile
        The help file data.
      • helpTopics

        protected java.util.ArrayList<Topic> helpTopics
        The stack of help topics.
      • lastUserInputTime

        protected long lastUserInputTime
        The last time user input (mouse or keyboard) was received.
    • Constructor Detail

      • TApplication

        public TApplication​(TApplication.BackendType backendType,
                            int windowWidth,
                            int windowHeight,
                            int fontSize)
                     throws java.io.UnsupportedEncodingException
        Public constructor.
        Parameters:
        backendType - BackendType.XTERM, BackendType.ECMA48 or BackendType.SWING
        windowWidth - the number of text columns to start with
        windowHeight - the number of text rows to start with
        fontSize - the size in points
        Throws:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • TApplication

        public TApplication​(TApplication.BackendType backendType)
                     throws java.io.UnsupportedEncodingException
        Public constructor.
        Parameters:
        backendType - BackendType.XTERM, BackendType.ECMA48 or BackendType.SWING
        Throws:
        java.io.UnsupportedEncodingException - if an exception is thrown when creating the InputStreamReader
      • TApplication

        public TApplication​(java.io.InputStream input,
                            java.io.OutputStream output)
                     throws java.io.UnsupportedEncodingException
        Public constructor. The backend type will be BackendType.ECMA48.
        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
      • TApplication

        public TApplication​(java.io.InputStream input,
                            java.io.Reader reader,
                            java.io.PrintWriter writer,
                            boolean setRawMode)
        Public constructor. The backend type will be BackendType.ECMA48.
        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.
      • TApplication

        public TApplication​(java.io.InputStream input,
                            java.io.Reader reader,
                            java.io.PrintWriter writer)
        Public constructor. The backend type will be BackendType.ECMA48.
        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.
      • TApplication

        public TApplication​(Backend backend)
        Public constructor. This hook enables use with new non-Jexer backends.
        Parameters:
        backend - a Backend that is already ready to go.
    • Method Detail

      • run

        public void run()
        Run this application until it exits.
        Specified by:
        run in interface java.lang.Runnable
      • onCommand

        protected boolean onCommand​(TCommandEvent command)
        Method that TApplication subclasses can override to handle menu or posted command events.
        Parameters:
        command - command event
        Returns:
        if true, this event was consumed
      • onMenu

        protected boolean onMenu​(TMenuEvent menu)
        Method that TApplication subclasses can override to handle menu events.
        Parameters:
        menu - menu event
        Returns:
        if true, this event was consumed
      • onKeypress

        protected boolean onKeypress​(TKeypressEvent keypress)
        Method that TApplication subclasses can override to handle keystrokes.
        Parameters:
        keypress - keystroke event
        Returns:
        if true, this event was consumed
      • enableSecondaryEventReceiver

        public final void enableSecondaryEventReceiver​(TWidget widget)
        Enable a widget to override the primary event thread.
        Parameters:
        widget - widget that will receive events
      • yield

        public final void yield()
        Yield to the secondary thread.
      • invokeLater

        public void invokeLater​(java.lang.Runnable command)
        Place a command on the run queue, and run it before the next round of checking I/O.
        Parameters:
        command - the command to run later
      • restoreConsole

        public void restoreConsole()
        Restore the console to sane defaults. This is meant to be used for improper exits (e.g. a caught exception in main()), and should not be necessary for normal program termination.
      • getBackend

        public final Backend getBackend()
        Get the Backend.
        Returns:
        the Backend
      • getScreen

        public final Screen getScreen()
        Get the Screen.
        Returns:
        the Screen
      • getTheme

        public final ColorTheme getTheme()
        Get the color theme.
        Returns:
        the theme
      • getClipboard

        public final Clipboard getClipboard()
        Get the clipboard.
        Returns:
        the clipboard
      • doRepaint

        public void doRepaint()
        Repaint the screen on the next update.
      • getDesktopTop

        public final int getDesktopTop()
        Get Y coordinate of the top edge of the desktop.
        Returns:
        Y coordinate of the top edge of the desktop
      • getDesktopBottom

        public final int getDesktopBottom()
        Get Y coordinate of the bottom edge of the desktop.
        Returns:
        Y coordinate of the bottom edge of the desktop
      • setDesktop

        public final void setDesktop​(TDesktop desktop)
        Set the TDesktop instance.
        Parameters:
        desktop - a TDesktop instance, or null to remove the one that is set
      • setDesktop

        public final void setDesktop​(TDesktop desktop,
                                     boolean close)
        Set the TDesktop instance.
        Parameters:
        desktop - a TDesktop instance, or null to remove the one that is set
        close - if true, close the previous desktop
      • getDesktop

        public final TDesktop getDesktop()
        Get the TDesktop instance.
        Returns:
        the desktop, or null if it is not set
      • getActiveWindow

        public final TWindow getActiveWindow()
        Get the current active window.
        Returns:
        the active window, or null if it is not set
      • getAllWindows

        public final java.util.List<TWindow> getAllWindows()
        Get a (shallow) copy of the window list.
        Returns:
        a copy of the list of windows for this application
      • getFocusFollowsMouse

        public boolean getFocusFollowsMouse()
        Get focusFollowsMouse flag.
        Returns:
        true if focus follows mouse: windows automatically raised if the mouse passes over them
      • setFocusFollowsMouse

        public void setFocusFollowsMouse​(boolean focusFollowsMouse)
        Set focusFollowsMouse flag.
        Parameters:
        focusFollowsMouse - if true, focus follows mouse: windows automatically raised if the mouse passes over them
      • setHideMenuBar

        public void setHideMenuBar​(boolean hideMenuBar)
        Set hideMenuBar flag.
        Parameters:
        hideMenuBar - if true, the menu bar will not be visible, and the desktop will cover the top line
      • setHideStatusBar

        public void setHideStatusBar​(boolean hideStatusBar)
        Set hideStatusBar flag.
        Parameters:
        hideStatusBar - if true, the status bar will not be visible, and the desktop will cover the bottom line
      • showAboutDialog

        protected void showAboutDialog()
        Display the about dialog.
      • isRunning

        public final boolean isRunning()
        Check if application is still running.
        Returns:
        true if the application is running
      • isModalThreadRunning

        public boolean isModalThreadRunning()
        Check if a system-wide modal thread is running. This thread is used to drive a few special dialog boxes such as TMessageBox, TInputBox, and TFileOpenBox.
        Returns:
        true if the modal (secondary) thread is running
      • onPreDraw

        protected void onPreDraw()
        Function called immediately before the screen is drawn. This can be used by subclasses of TApplication to update things, for example to set menuTrayText.
      • onPostDraw

        protected void onPostDraw()
        Function called immediately after the screen is drawn, while the screen is still synchronized/locked. This can be used by subclasses of TApplication to alter the final post-rendered screen before it goes out -- or even replace the entire thing such as a screensaver.
      • exit

        public void exit()
        Force this application to exit.
      • onExit

        public void onExit()
        Subclasses can use this hook to cleanup resources. Called as the last step of TApplication.run().
      • windowCount

        public final int windowCount()
        Return the total number of windows.
        Returns:
        the total number of windows
      • shownWindowCount

        public final int shownWindowCount()
        Return the number of windows that are showing.
        Returns:
        the number of windows that are showing on screen
      • hiddenWindowCount

        public final int hiddenWindowCount()
        Return the number of windows that are hidden.
        Returns:
        the number of windows that are hidden
      • hasWindow

        public final boolean hasWindow​(TWindow window)
        Check if a window instance is in this application's window list.
        Parameters:
        window - window to look for
        Returns:
        true if this window is in the list
      • activateWindow

        public final void activateWindow​(TWindow window)
        Activate a window: bring it to the top and have it receive events.
        Parameters:
        window - the window to become the new active window
      • hideWindow

        public void hideWindow​(TWindow window)
        Hide a window.
        Parameters:
        window - the window to hide
      • showWindow

        public void showWindow​(TWindow window)
        Show a window.
        Parameters:
        window - the window to show
      • closeWindow

        public final void closeWindow​(TWindow window)
        Close window.
        Parameters:
        window - the window to remove
      • switchWindow

        public final void switchWindow​(boolean forward)
        Switch to the next window.
        Parameters:
        forward - if true, then switch to the next window in the list, otherwise switch to the previous window in the list
      • doSmartPlacement

        public final void doSmartPlacement​(TWindow window)
        Place a window to minimize its overlap with other windows.
        Parameters:
        window - the window to place
      • closeMenu

        public final void closeMenu()
        Turn off the menu.
      • getAllMenus

        public final java.util.List<TMenu> getAllMenus()
        Get a (shallow) copy of the menu list.
        Returns:
        a copy of the menu list
      • openContextMenu

        public final void openContextMenu​(TMenu menu,
                                          int x,
                                          int y)
        Open a previously created menu as a context menu at a specific location.
        Parameters:
        menu - the menu to open
        x - the context menu X position
        y - the context menu Y position
        Throws:
        java.lang.IllegalArgumentException - if the menu is already used in another TApplication
      • addMenu

        public final void addMenu​(TMenu menu)
        Add a top-level menu to the list.
        Parameters:
        menu - the menu to add
        Throws:
        java.lang.IllegalArgumentException - if the menu is already used in another TApplication
      • removeMenu

        public final void removeMenu​(TMenu menu)
        Remove a top-level menu from the list.
        Parameters:
        menu - the menu to remove
        Throws:
        java.lang.IllegalArgumentException - if the menu is already used in another TApplication
      • closeSubMenu

        public final void closeSubMenu()
        Turn off a sub-menu.
      • switchMenu

        public final void switchMenu​(boolean forward)
        Switch to the next menu.
        Parameters:
        forward - if true, then switch to the next menu in the list, otherwise switch to the previous menu in the list
      • addMenuItem

        public final void addMenuItem​(TMenuItem item)
        Add a menu item to the global list. If it has a keyboard accelerator, that will be added the global hash.
        Parameters:
        item - the menu item
      • disableMenuItem

        public final void disableMenuItem​(int id)
        Disable one menu item.
        Parameters:
        id - the menu item ID
      • disableMenuItems

        public final void disableMenuItems​(int lower,
                                           int upper)
        Disable the range of menu items with ID's between lower and upper, inclusive.
        Parameters:
        lower - the lowest menu item ID
        upper - the highest menu item ID
      • enableMenuItem

        public final void enableMenuItem​(int id)
        Enable one menu item.
        Parameters:
        id - the menu item ID
      • enableMenuItems

        public final void enableMenuItems​(int lower,
                                          int upper)
        Enable the range of menu items with ID's between lower and upper, inclusive.
        Parameters:
        lower - the lowest menu item ID
        upper - the highest menu item ID
      • getMenuItem

        public final TMenuItem getMenuItem​(int id)
        Get the menu item associated with this ID.
        Parameters:
        id - the menu item ID
        Returns:
        the menu item, or null if not found
      • recomputeMenuX

        public final void recomputeMenuX()
        Recompute menu x positions based on their title length.
      • postEvent

        public final void postEvent​(TInputEvent event)
        Post an event to process.
        Parameters:
        event - new event to add to the queue
      • postMenuEvent

        public final void postMenuEvent​(TInputEvent event)
        Post an event to process and turn off the menu.
        Parameters:
        event - new event to add to the queue
      • addSubMenu

        public final void addSubMenu​(TMenu menu)
        Add a sub-menu to the list of open sub-menus.
        Parameters:
        menu - sub-menu
      • addMenu

        public final TMenu addMenu​(java.lang.String title)
        Convenience function to add a top-level menu.
        Parameters:
        title - menu title
        Returns:
        the new menu
      • addToolMenu

        public final TMenu addToolMenu()
        Convenience function to add a default tools (hamburger) menu.
        Returns:
        the new menu
      • addFileMenu

        public final TMenu addFileMenu()
        Convenience function to add a default "File" menu.
        Returns:
        the new menu
      • addEditMenu

        public final TMenu addEditMenu()
        Convenience function to add a default "Edit" menu.
        Returns:
        the new menu
      • addWindowMenu

        public final TMenu addWindowMenu()
        Convenience function to add a default "Window" menu.
        Returns:
        the new menu
      • addHelpMenu

        public final TMenu addHelpMenu()
        Convenience function to add a default "Help" menu.
        Returns:
        the new menu
      • addTableMenu

        public final TMenu addTableMenu()
        Convenience function to add a default "Table" menu.
        Returns:
        the new menu
      • addTimer

        public final TTimer addTimer​(long duration,
                                     boolean recurring,
                                     TAction action)
        Convenience function to add a timer.
        Parameters:
        duration - number of milliseconds to wait between ticks
        recurring - if true, re-schedule this timer after every tick
        action - function to call when button is pressed
        Returns:
        the timer
      • removeTimer

        public final void removeTimer​(TTimer timer)
        Convenience function to remove a timer.
        Parameters:
        timer - timer to remove
      • messageBox

        public final TMessageBox messageBox​(java.lang.String title,
                                            java.lang.String caption)
        Convenience function to spawn a message box.
        Parameters:
        title - window title, will be centered along the top border
        caption - message to display. Use embedded newlines to get a multi-line box.
        Returns:
        the new message box
      • messageBox

        public final TMessageBox messageBox​(java.lang.String title,
                                            java.lang.String caption,
                                            TMessageBox.Type type)
        Convenience function to spawn a message box.
        Parameters:
        title - window title, will be centered along the top border
        caption - message to display. Use embedded newlines to get a multi-line box.
        type - one of the TMessageBox.Type constants. Default is Type.OK.
        Returns:
        the new message box
      • inputBox

        public final TInputBox inputBox​(java.lang.String title,
                                        java.lang.String caption)
        Convenience function to spawn an input box.
        Parameters:
        title - window title, will be centered along the top border
        caption - message to display. Use embedded newlines to get a multi-line box.
        Returns:
        the new input box
      • inputBox

        public final TInputBox inputBox​(java.lang.String title,
                                        java.lang.String caption,
                                        java.lang.String text)
        Convenience function to spawn an input box.
        Parameters:
        title - window title, will be centered along the top border
        caption - message to display. Use embedded newlines to get a multi-line box.
        text - initial text to seed the field with
        Returns:
        the new input box
      • inputBox

        public final TInputBox inputBox​(java.lang.String title,
                                        java.lang.String caption,
                                        java.lang.String text,
                                        TMessageBox.Type type)
        Convenience function to spawn an input box.
        Parameters:
        title - window title, will be centered along the top border
        caption - message to display. Use embedded newlines to get a multi-line box.
        text - initial text to seed the field with
        type - one of the Type constants. Default is Type.OK.
        Returns:
        the new input box
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y)
        Convenience function to open a terminal window.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  boolean closeOnExit)
        Convenience function to open a terminal window.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        closeOnExit - if true, close the window when the command exits
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  int flags)
        Convenience function to open a terminal window.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        flags - mask of CENTERED, MODAL, or RESIZABLE
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  int flags,
                                                  boolean closeOnExit)
        Convenience function to open a terminal window.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        flags - mask of CENTERED, MODAL, or RESIZABLE
        closeOnExit - if true, close the window when the command exits
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  java.lang.String commandLine)
        Convenience function to open a terminal window and execute a custom command line inside it.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        commandLine - the command line to execute
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  java.lang.String commandLine,
                                                  boolean closeOnExit)
        Convenience function to open a terminal window and execute a custom command line inside it.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        commandLine - the command line to execute
        closeOnExit - if true, close the window when the command exits
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  int flags,
                                                  java.lang.String[] command)
        Convenience function to open a terminal window and execute a custom command line inside it.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        flags - mask of CENTERED, MODAL, or RESIZABLE
        command - the command line to execute
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  int flags,
                                                  java.lang.String[] command,
                                                  boolean closeOnExit)
        Convenience function to open a terminal window and execute a custom command line inside it.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        flags - mask of CENTERED, MODAL, or RESIZABLE
        command - the command line to execute
        closeOnExit - if true, close the window when the command exits
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  int flags,
                                                  java.lang.String commandLine)
        Convenience function to open a terminal window and execute a custom command line inside it.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        flags - mask of CENTERED, MODAL, or RESIZABLE
        commandLine - the command line to execute
        Returns:
        the terminal new window
      • openTerminal

        public final TTerminalWindow openTerminal​(int x,
                                                  int y,
                                                  int flags,
                                                  java.lang.String commandLine,
                                                  boolean closeOnExit)
        Convenience function to open a terminal window and execute a custom command line inside it.
        Parameters:
        x - column relative to parent
        y - row relative to parent
        flags - mask of CENTERED, MODAL, or RESIZABLE
        commandLine - the command line to execute
        closeOnExit - if true, close the window when the command exits
        Returns:
        the terminal new window
      • fileOpenBox

        public final java.lang.String fileOpenBox​(java.lang.String path)
                                           throws java.io.IOException
        Convenience function to spawn an file open box.
        Parameters:
        path - path of selected file
        Returns:
        the result of the new file open box
        Throws:
        java.io.IOException - if java.io operation throws
      • fileOpenBox

        public final java.lang.String fileOpenBox​(java.lang.String path,
                                                  TFileOpenBox.Type type)
                                           throws java.io.IOException
        Convenience function to spawn an file open box.
        Parameters:
        path - path of selected file
        type - one of the Type constants
        Returns:
        the result of the new file open box
        Throws:
        java.io.IOException - if java.io operation throws
      • fileOpenBox

        public final java.lang.String fileOpenBox​(java.lang.String path,
                                                  TFileOpenBox.Type type,
                                                  java.lang.String filter)
                                           throws java.io.IOException
        Convenience function to spawn a file open box.
        Parameters:
        path - path of selected file
        type - one of the Type constants
        filter - a string that files must match to be displayed
        Returns:
        the result of the new file open box
        Throws:
        java.io.IOException - of a java.io operation throws
      • fileOpenBox

        public final java.lang.String fileOpenBox​(java.lang.String path,
                                                  TFileOpenBox.Type type,
                                                  java.util.List<java.lang.String> filters)
                                           throws java.io.IOException
        Convenience function to spawn a file open box.
        Parameters:
        path - path of selected file
        type - one of the Type constants
        filters - a list of strings that files must match to be displayed
        Returns:
        the result of the new file open box
        Throws:
        java.io.IOException - of a java.io operation throws
      • fileSaveBox

        public final java.lang.String fileSaveBox​(java.lang.String path)
                                           throws java.io.IOException
        Convenience function to spawn a file save box.
        Parameters:
        path - path of selected file
        Returns:
        the result of the new file open box
        Throws:
        java.io.IOException - if a java.io operation throws
      • addWindow

        public final TWindow addWindow​(java.lang.String title,
                                       int width,
                                       int height)
        Convenience function to create a new window and make it active. Window will be located at (0, 0).
        Parameters:
        title - window title, will be centered along the top border
        width - width of window
        height - height of window
        Returns:
        the new window
      • addWindow

        public final TWindow addWindow​(java.lang.String title,
                                       int width,
                                       int height,
                                       int flags)
        Convenience function to create a new window and make it active. Window will be located at (0, 0).
        Parameters:
        title - window title, will be centered along the top border
        width - width of window
        height - height of window
        flags - bitmask of RESIZABLE, CENTERED, or MODAL
        Returns:
        the new window
      • addWindow

        public final TWindow addWindow​(java.lang.String title,
                                       int x,
                                       int y,
                                       int width,
                                       int height)
        Convenience function to create a new window and make it active.
        Parameters:
        title - window title, will be centered along the top border
        x - column relative to parent
        y - row relative to parent
        width - width of window
        height - height of window
        Returns:
        the new window
      • addWindow

        public final TWindow addWindow​(java.lang.String title,
                                       int x,
                                       int y,
                                       int width,
                                       int height,
                                       int flags)
        Convenience function to create a new window and make it active.
        Parameters:
        title - window title, will be centered along the top border
        x - column relative to parent
        y - row relative to parent
        width - width of window
        height - height of window
        flags - mask of RESIZABLE, CENTERED, or MODAL
        Returns:
        the new window