Package jexer
Class TApplication
- java.lang.Object
-
- jexer.TApplication
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
DemoApplication,DesktopDemoApplication
public class TApplication extends java.lang.Object implements java.lang.RunnableTApplication 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 classTApplication.BackendTypeTwo backend types are available.
-
Field Summary
Fields Modifier and Type Field Description protected MousePointercustomMousePointerAn optional mouse pointer.protected MousePointercustomWidgetMousePointerAn optional mouse pointer for the widget under the mouse.protected booleandesktopCanHaveCursorIf true, the desktop can have the cursor blinking/visible even if the top-most window does not have the cursor active.protected HelpFilehelpFileThe help file data.protected java.util.ArrayList<Topic>helpTopicsThe stack of help topics.static booleanimageSupportTestIf true, do not confirm on exit, and leave the terminal in its final state (do not restore the console).protected longlastUserInputTimeThe last time user input (mouse or keyboard) was received.protected java.lang.StringmenuTrayTextOptional text to display at the top right of the menu.protected TackboardoverlayThe pixel-based overlay.protected booleansmartWindowPlacementIf true, do "smart placement" on new windows that are not specified to be centered.protected booleantextMouseIf true, display a text-based mouse cursor.protected booleantranslucenceIf true.
-
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 voidactivateWindow(TWindow window)Activate a window: bring it to the top and have it receive events.TMenuaddEditMenu()Convenience function to add a default "Edit" menu.TMenuaddFileMenu()Convenience function to add a default "File" menu.TMenuaddHelpMenu()Convenience function to add a default "Help" menu.TMenuaddMenu(java.lang.String title)Convenience function to add a top-level menu.voidaddMenu(TMenu menu)Add a top-level menu to the list.voidaddMenuItem(TMenuItem item)Add a menu item to the global list.voidaddOverlay(MousePointer item)Add a tackboard item to the overlay.voidaddSubMenu(TMenu menu)Add a sub-menu to the list of open sub-menus.TMenuaddTableMenu()Convenience function to add a default "Table" menu.TTimeraddTimer(long duration, boolean recurring, TAction action)Convenience function to add a timer.TMenuaddToolMenu()Convenience function to add a default tools (hamburger) menu.TWindowaddWindow(java.lang.String title, int width, int height)Convenience function to create a new window and make it active.TWindowaddWindow(java.lang.String title, int width, int height, int flags)Convenience function to create a new window and make it active.TWindowaddWindow(java.lang.String title, int x, int y, int width, int height)Convenience function to create a new window and make it active.TWindowaddWindow(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.TMenuaddWindowMenu()Convenience function to add a default "Window" menu.voidcloseMenu()Turn off the menu.voidcloseSubMenu()Turn off a sub-menu.voidcloseWindow(TWindow window)Close window.voiddisableMenuItem(int id)Disable one menu item.voiddisableMenuItems(int lower, int upper)Disable the range of menu items with ID's between lower and upper, inclusive.voiddoRepaint()Repaint the screen on the next update.voiddoSmartPlacement(TWindow window)Place a window to minimize its overlap with other windows.voidenableMenuItem(int id)Enable one menu item.voidenableMenuItems(int lower, int upper)Enable the range of menu items with ID's between lower and upper, inclusive.voidenableSecondaryEventReceiver(TWidget widget)Enable a widget to override the primary event thread.voidexit()Force this application to exit.java.lang.StringfileOpenBox(java.lang.String path)Convenience function to spawn an file open box.java.lang.StringfileOpenBox(java.lang.String path, TFileOpenBox.Type type)Convenience function to spawn an file open box.java.lang.StringfileOpenBox(java.lang.String path, TFileOpenBox.Type type, java.lang.String filter)Convenience function to spawn a file open box.java.lang.StringfileOpenBox(java.lang.String path, TFileOpenBox.Type type, java.util.List<java.lang.String> filters)Convenience function to spawn a file open box.java.lang.StringfileSaveBox(java.lang.String path)Convenience function to spawn a file save box.TWindowgetActiveWindow()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.BackendgetBackend()Get the Backend.ClipboardgetClipboard()Get the clipboard.MousePointergetCustomMousePointer()Get the custom mouse pointer.TDesktopgetDesktop()Get the TDesktop instance.intgetDesktopBottom()Get Y coordinate of the bottom edge of the desktop.intgetDesktopTop()Get Y coordinate of the top edge of the desktop.booleangetFocusFollowsMouse()Get focusFollowsMouse flag.intgetFramesPerSecond()Get the number of frames that were emitted to output on the last second.java.util.LocalegetLocale()Get the Locale used for producing user-facing strings.TMenuItemgetMenuItem(int id)Get the menu item associated with this ID.TackboardgetOverlay()Get the pixel-based overlay.ScreengetScreen()Get the Screen.ColorThemegetTheme()Get the global color theme.booleanhasTranslucence()Get the translucence option.booleanhasWindow(TWindow window)Check if a window instance is in this application's window list.inthiddenWindowCount()Return the number of windows that are hidden.voidhideWindow(TWindow window)Hide a window.TInputBoxinputBox(java.lang.String title, java.lang.String caption)Convenience function to spawn an input box.TInputBoxinputBox(java.lang.String title, java.lang.String caption, java.lang.String text)Convenience function to spawn an input box.TInputBoxinputBox(java.lang.String title, java.lang.String caption, java.lang.String text, TMessageBox.Type type)Convenience function to spawn an input box.voidinvokeLater(java.lang.Runnable command)Place a command on the run queue, and run it before the next round of checking I/O.booleanisModalThreadRunning()Check if a system-wide modal thread is running.booleanisRunning()Check if application is still running.TMessageBoxmessageBox(java.lang.String title, java.lang.String caption)Convenience function to spawn a message box.TMessageBoxmessageBox(java.lang.String title, java.lang.String caption, TMessageBox.Type type)Convenience function to spawn a message box.protected booleanonCommand(TCommandEvent command)Method that TApplication subclasses can override to handle menu or posted command events.voidonExit()Subclasses can use this hook to cleanup resources.protected booleanonKeypress(TKeypressEvent keypress)Method that TApplication subclasses can override to handle keystrokes.protected booleanonMenu(TMenuEvent menu)Method that TApplication subclasses can override to handle menu events.protected voidonPostDraw()Function called immediately after the screen is drawn, while the screen is still synchronized/locked.protected voidonPreDraw()Function called immediately before the screen is drawn.voidopenContextMenu(TMenu menu, int x, int y)Open a previously created menu as a context menu at a specific location.TTerminalWindowopenTerminal(int x, int y)Convenience function to open a terminal window.TTerminalWindowopenTerminal(int x, int y, boolean closeOnExit)Convenience function to open a terminal window.TTerminalWindowopenTerminal(int x, int y, int flags)Convenience function to open a terminal window.TTerminalWindowopenTerminal(int x, int y, int flags, boolean closeOnExit)Convenience function to open a terminal window.TTerminalWindowopenTerminal(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.TTerminalWindowopenTerminal(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.TTerminalWindowopenTerminal(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.TTerminalWindowopenTerminal(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.TTerminalWindowopenTerminal(int x, int y, java.lang.String commandLine)Convenience function to open a terminal window and execute a custom command line inside it.TTerminalWindowopenTerminal(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.voidpostEvent(TInputEvent event)Post an event to process.voidpostMenuEvent(TInputEvent event)Post an event to process and turn off the menu.voidrecomputeMenuX()Recompute menu x positions based on their title length.voidremoveMenu(TMenu menu)Remove a top-level menu from the list.voidremoveTimer(TTimer timer)Convenience function to remove a timer.voidrestoreConsole()Restore the console to sane defaults.voidrun()Run this application until it exits.voidsetCustomMousePointer(MousePointer pointer)Set a custom mouse pointer.voidsetDesktop(TDesktop desktop)Set the TDesktop instance.voidsetDesktop(TDesktop desktop, boolean close)Set the TDesktop instance.voidsetFocusFollowsMouse(boolean focusFollowsMouse)Set focusFollowsMouse flag.voidsetHideMenuBar(boolean hideMenuBar)Set hideMenuBar flag.voidsetHideStatusBar(boolean hideStatusBar)Set hideStatusBar flag.voidsetLocale(java.util.Locale locale)Set the Locale used for producing user-facing strings.voidsetTranslucence(boolean enabled)Set the translucence option.voidsetWindowOpacity(int opacity)Set the opacity of all windows.protected voidshowAboutDialog()Display the about dialog.intshownWindowCount()Return the number of windows that are showing.voidshowWindow(TWindow window)Show a window.voidswitchMenu(boolean forward)Switch to the next menu.voidswitchWindow(boolean forward)Switch to the next window.intwindowCount()Return the total number of windows.voidyield()Yield to the secondary thread.
-
-
-
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.
-
overlay
protected Tackboard overlay
The pixel-based overlay.
-
customMousePointer
protected MousePointer customMousePointer
An optional mouse pointer.
-
customWidgetMousePointer
protected MousePointer customWidgetMousePointer
An optional mouse pointer for the widget under the mouse.
-
translucence
protected boolean translucence
If true. enable translucency.
-
-
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.SWINGwindowWidth- the number of text columns to start withwindowHeight- the number of text rows to start withfontSize- 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.UnsupportedEncodingExceptionPublic 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:
runin interfacejava.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
-
getLocale
public final java.util.Locale getLocale()
Get the Locale used for producing user-facing strings.- Returns:
- the locale
-
setLocale
public final void setLocale(java.util.Locale locale)
Set the Locale used for producing user-facing strings.- Parameters:
locale- the locale. If null, reset to the default JVM Locale.
-
getTheme
public final ColorTheme getTheme()
Get the global color theme.- Returns:
- the theme
-
hasTranslucence
public boolean hasTranslucence()
Get the translucence option.- Returns:
- true if translucency is enabled
-
setTranslucence
public void setTranslucence(boolean enabled)
Set the translucence option.- Parameters:
enabled- if true, windows will be translucent
-
setWindowOpacity
public void setWindowOpacity(int opacity)
Set the opacity of all windows. If opacity is 100, translucence is also disabled for performance.- Parameters:
opacity- a number between 10 (nearly transparent) and 100 (fully opaque)
-
getFramesPerSecond
public int getFramesPerSecond()
Get the number of frames that were emitted to output on the last second.- Returns:
- the frames per second
-
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 setclose- 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
-
getOverlay
public final Tackboard getOverlay()
Get the pixel-based overlay.- Returns:
- the overlay
-
addOverlay
public void addOverlay(MousePointer item)
Add a tackboard item to the overlay.- Parameters:
item- the item to add
-
getCustomMousePointer
public final MousePointer getCustomMousePointer()
Get the custom mouse pointer.- Returns:
- the custom mouse pointer, or null if it was never set
-
setCustomMousePointer
public final void setCustomMousePointer(MousePointer pointer)
Set a custom mouse pointer.- Parameters:
pointer- the new mouse pointer, or null to use the default mouse pointer.
-
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 openx- the context menu X positiony- 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 IDupper- 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 IDupper- 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 ticksrecurring- if true, re-schedule this timer after every tickaction- 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 bordercaption- 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 bordercaption- 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 bordercaption- 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 bordercaption- 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 bordercaption- message to display. Use embedded newlines to get a multi-line box.text- initial text to seed the field withtype- 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 parenty- 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 parenty- row relative to parentcloseOnExit- 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 parenty- row relative to parentflags- 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 parenty- row relative to parentflags- mask of CENTERED, MODAL, or RESIZABLEcloseOnExit- 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 parenty- row relative to parentcommandLine- 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 parenty- row relative to parentcommandLine- the command line to executecloseOnExit- 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 parenty- row relative to parentflags- mask of CENTERED, MODAL, or RESIZABLEcommand- the command line to execute, as an array of strings which signifies the external program file to be invoked (command[0]) and its arguments, if any (command[1], command[2], ...). Refer also to java.lang.ProcessBuilder for further operating-system specific details.- 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 parenty- row relative to parentflags- mask of CENTERED, MODAL, or RESIZABLEcommand- the command line to execute, as an array of strings which signifies the external program file to be invoked (command[0]) and its arguments, if any (command[1], command[2], ...). Refer also to java.lang.ProcessBuilder for further operating-system specific details.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 parenty- row relative to parentflags- mask of CENTERED, MODAL, or RESIZABLEcommandLine- 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 parenty- row relative to parentflags- mask of CENTERED, MODAL, or RESIZABLEcommandLine- the command line to executecloseOnExit- 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.IOExceptionConvenience 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.IOExceptionConvenience function to spawn an file open box.- Parameters:
path- path of selected filetype- 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.IOExceptionConvenience function to spawn a file open box.- Parameters:
path- path of selected filetype- one of the Type constantsfilter- 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.IOExceptionConvenience function to spawn a file open box.- Parameters:
path- path of selected filetype- one of the Type constantsfilters- 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.IOExceptionConvenience 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 borderwidth- width of windowheight- 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 borderwidth- width of windowheight- height of windowflags- 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 borderx- column relative to parenty- row relative to parentwidth- width of windowheight- 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 borderx- column relative to parenty- row relative to parentwidth- width of windowheight- height of windowflags- mask of RESIZABLE, CENTERED, or MODAL- Returns:
- the new window
-
-