Package jexer
Class TWidget
- java.lang.Object
-
- jexer.TWidget
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
- Direct Known Subclasses:
TButton
,TCalendar
,TCheckBox
,TComboBox
,TEditorWidget
,TField
,THScroller
,TImage
,TLabel
,TMenuItem
,TPanel
,TParagraph
,TProgressBar
,TRadioButton
,TRadioGroup
,TScrollableWidget
,TSpinner
,TSplitPane
,TStatusBar
,TTableWidget
,TTableWidget.Cell
,TTreeItem
,TTreeView
,TVScroller
,TWindow
,TWord
public abstract class TWidget extends java.lang.Object implements java.lang.Comparable<TWidget>
TWidget is the base class of all objects that can be drawn on screen or handle user input events.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TWidget()
Default constructor for subclasses.protected
TWidget(TWidget parent)
Protected constructor.protected
TWidget(TWidget parent, boolean enabled)
Protected constructor used by subclasses that are disabled by default.protected
TWidget(TWidget parent, boolean enabled, int x, int y, int width, int height)
Protected constructor used by subclasses that are disabled by default.protected
TWidget(TWidget parent, int x, int y, int width, int height)
Protected constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Make this widget the active child of its parent.void
activate(int tabOrder)
Switch the active child.void
activate(TWidget child)
Switch the active child.void
activateAll()
Make this widget, all of its parents, the active child.TButton
addButton(java.lang.String text, int x, int y, TAction action)
Convenience function to add a button to this container/window.TCalendar
addCalendar(int x, int y, TAction updateAction)
Convenience function to add a calendar to this container/window.TCheckBox
addCheckBox(int x, int y, java.lang.String label, boolean checked)
Convenience function to add a checkbox to this container/window.TCheckBox
addCheckBox(int x, int y, java.lang.String label, boolean checked, TAction action)
Convenience function to add a checkbox to this container/window.TComboBox
addComboBox(int x, int y, int width, java.util.List<java.lang.String> values, int valuesIndex, int maxValuesHeight, TAction updateAction)
Convenience function to add a combobox to this container/window.TDirectoryList
addDirectoryList(java.lang.String path, int x, int y, int width, int height)
Convenience function to add a directory list to this container/window.TDirectoryList
addDirectoryList(java.lang.String path, int x, int y, int width, int height, TAction action)
Convenience function to add a directory list to this container/window.TDirectoryList
addDirectoryList(java.lang.String path, int x, int y, int width, int height, TAction action, TAction singleClickAction)
Convenience function to add a directory list to this container/window.TDirectoryList
addDirectoryList(java.lang.String path, int x, int y, int width, int height, TAction action, TAction singleClickAction, java.util.List<java.lang.String> filters)
Convenience function to add a directory list to this container/window.TEditorWidget
addEditor(java.lang.String text, int x, int y, int width, int height)
Convenience function to add an editable text area box to this container/window.TField
addField(int x, int y, int width, boolean fixed)
Convenience function to add a text field to this container/window.TField
addField(int x, int y, int width, boolean fixed, java.lang.String text)
Convenience function to add a text field to this container/window.TField
addField(int x, int y, int width, boolean fixed, java.lang.String text, TAction enterAction)
Convenience function to add a text field to this container/window.TField
addField(int x, int y, int width, boolean fixed, java.lang.String text, TAction enterAction, TAction updateAction)
Convenience function to add a text field to this container/window.TImage
addImage(int x, int y, int width, int height, java.awt.image.BufferedImage image, int left, int top)
Convenience function to add an image to this container/window.TImage
addImage(int x, int y, int width, int height, java.awt.image.BufferedImage image, int left, int top, TAction clickAction)
Convenience function to add an image to this container/window.TLabel
addLabel(java.lang.String text, int x, int y)
Convenience function to add a label to this container/window.TLabel
addLabel(java.lang.String text, int x, int y, java.lang.String colorKey)
Convenience function to add a label to this container/window.TLabel
addLabel(java.lang.String text, int x, int y, java.lang.String colorKey, boolean useWindowBackground)
Convenience function to add a label to this container/window.TLabel
addLabel(java.lang.String text, int x, int y, java.lang.String colorKey, boolean useWindowBackground, TAction action)
Convenience function to add a label to this container/window.TLabel
addLabel(java.lang.String text, int x, int y, java.lang.String colorKey, TAction action)
Convenience function to add a label to this container/window.TLabel
addLabel(java.lang.String text, int x, int y, TAction action)
Convenience function to add a label to this container/window.TList
addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height)
Convenience function to add a list to this container/window.TList
addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction)
Convenience function to add a list to this container/window.TList
addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction, TAction moveAction)
Convenience function to add a list to this container/window.TList
addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction, TAction moveAction, TAction singleClickAction)
Convenience function to add a list to this container/window.TPanel
addPanel(int x, int y, int width, int height)
Convenience function to add a panel to this container/window.TPasswordField
addPasswordField(int x, int y, int width, boolean fixed)
Convenience function to add a password text field to this container/window.TPasswordField
addPasswordField(int x, int y, int width, boolean fixed, java.lang.String text)
Convenience function to add a password text field to this container/window.TPasswordField
addPasswordField(int x, int y, int width, boolean fixed, java.lang.String text, TAction enterAction, TAction updateAction)
Convenience function to add a password text field to this container/window.TProgressBar
addProgressBar(int x, int y, int width, int value)
Convenience function to add a progress bar to this container/window.TRadioGroup
addRadioGroup(int x, int y, int width, java.lang.String label)
Convenience function to add a radio button group to this container/window.TRadioGroup
addRadioGroup(int x, int y, java.lang.String label)
Convenience function to add a radio button group to this container/window.TSpinner
addSpinner(int x, int y, TAction upAction, TAction downAction)
Convenience function to add a spinner to this container/window.TSplitPane
addSplitPane(int x, int y, int width, int height, boolean vertical)
Convenience function to add a split pane to this container/window.TTableWidget
addTable(int x, int y, int width, int height)
Convenience function to add an editable 2D data table to this container/window.TTableWidget
addTable(int x, int y, int width, int height, int gridColumns, int gridRows)
Convenience function to add an editable 2D data table to this container/window.TText
addText(java.lang.String text, int x, int y, int width, int height)
Convenience function to add a scrollable text box to this container/window.TText
addText(java.lang.String text, int x, int y, int width, int height, java.lang.String colorKey)
Convenience function to add a scrollable text box to this container/window.TTreeViewWidget
addTreeViewWidget(int x, int y, int width, int height)
Convenience function to add a scrollable tree view to this container/window.TTreeViewWidget
addTreeViewWidget(int x, int y, int width, int height, TAction action)
Convenience function to add a scrollable tree view to this container/window.void
close()
Subclasses should override this method to cleanup resources.int
compareTo(TWidget that)
Comparison operator.protected void
doRepaint()
Repaint the screen on the next update.void
draw()
Draw my specific widget.void
drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)
Draw a box with a border and empty background.void
drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, int borderType, boolean shadow)
Draw a box with a border and empty background.void
drawBoxShadow(int left, int top, int right, int bottom)
Draw a box shadow.void
drawChildren()
Called by parent to render to TWindow.java.lang.String
fileOpenBox(java.lang.String path)
Convenience function to spawn a file open box.java.lang.String
fileOpenBox(java.lang.String path, TFileOpenBox.Type type)
Convenience function to spawn a 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.int
getAbsoluteX()
Compute my absolute X position as the sum of my X plus all my parent's X's.int
getAbsoluteY()
Compute my absolute Y position as the sum of my Y plus all my parent's Y's.TWidget
getActiveChild()
Returns my active widget.TApplication
getApplication()
Get this TWidget's parent TApplication.CellAttributes
getAttrXY(int x, int y)
Get the attributes at one location.java.util.List<TWidget>
getChildren()
Get the list of child widgets that this widget contains.Clipboard
getClipboard()
Get the Clipboard.int
getCursorAbsoluteX()
Returns the cursor X position.int
getCursorAbsoluteY()
Returns the cursor Y position.int
getCursorX()
Get cursor X value.int
getCursorY()
Get cursor Y value.MousePointer
getCustomMousePointer()
Get the custom mouse pointer.int
getHeight()
Get the height.LayoutManager
getLayoutManager()
Get the layout manager.java.lang.String
getMouseStyle()
Get the mouse pointer (cursor) style.TWidget
getParent()
Get parent widget.Screen
getScreen()
Get the Screen.ColorTheme
getTheme()
Get the global color theme.TWidget
getWidgetUnderMouse(TMouseEvent mouse)
Returns the widget under the mouse.int
getWidth()
Get the width.TWindow
getWindow()
Get the window this widget is on.int
getX()
Get X position.int
getY()
Get Y position.void
handleEvent(TInputEvent event)
Consume event.boolean
hasChild(TWidget child)
See if a widget is a child of this widget.void
hLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a horizontal line from (x, y) to (x + n, y).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.boolean
isAbsoluteActive()
See if this widget is the active window within its hierarchy.boolean
isActive()
Get active flag.boolean
isCursorVisible()
See if this widget has a visible cursor.boolean
isDrawable()
See if this widget can be drawn onto a screen.boolean
isEchoKeystrokes()
Get echo keystrokes flag.boolean
isEnabled()
Get enabled flag.boolean
isPixelMouse()
Check if per-pixel mouse events are requested.boolean
isVisible()
See if this widget is visible.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.boolean
mouseWouldHit(TMouseEvent mouse)
Check if a mouse press/release event coordinate is contained in this widget.void
onCommand(TCommandEvent command)
Method that subclasses can override to handle posted command events.void
onIdle()
Method that subclasses can override to do processing when the UI is idle.void
onKeypress(TKeypressEvent keypress)
Method that subclasses can override to handle keystrokes.void
onMenu(TMenuEvent menu)
Method that subclasses can override to handle menu or posted menu events.void
onMouseDoubleClick(TMouseEvent mouse)
Method that subclasses can override to handle mouse button double-clicks.void
onMouseDown(TMouseEvent mouse)
Method that subclasses can override to handle mouse button presses.void
onMouseMotion(TMouseEvent mouse)
Method that subclasses can override to handle mouse movements.void
onMouseUp(TMouseEvent mouse)
Method that subclasses can override to handle mouse button releases.void
onResize(TResizeEvent resize)
Method that subclasses can override to handle window/screen resize events.void
putAll(int ch, CellAttributes attr)
Fill the entire screen with one character with attributes.void
putAttrXY(int x, int y, CellAttributes attr)
Set the attributes at one location.void
putAttrXY(int x, int y, CellAttributes attr, boolean clip)
Set the attributes at one location.void
putCharXY(int x, int y, int ch)
Render one character without changing the underlying attributes.void
putCharXY(int x, int y, int ch, CellAttributes attr)
Render one character with attributes.void
putCharXY(int x, int y, Cell ch)
Render one character with attributes.void
putStringXY(int x, int y, java.lang.String str)
Render a string without changing the underlying attribute.void
putStringXY(int x, int y, java.lang.String str, CellAttributes attr)
Render a string.void
remove()
Remove this widget from its parent container.void
remove(boolean doClose)
Remove this widget from its parent container.void
remove(TWidget child)
Remove a child widget from this container.void
remove(TWidget child, boolean doClose)
Remove a child widget from this container.void
removeAll(TWidget child, boolean doClose)
Remove a child widget from this container, and all of its children recursively from their parent containers.protected void
resetTabOrder()
Reset the tab order of children to match their position in the list.void
setActive(boolean active)
Set active flag.void
setCursorVisible(boolean cursorVisible)
Set visible cursor flag.void
setCursorX(int cursorX)
Set cursor X value.void
setCursorY(int cursorY)
Set cursor Y value.void
setCustomMousePointer(MousePointer pointer)
Set a custom mouse pointer.void
setDimensions(int x, int y, int width, int height)
Change the dimensions.void
setEchoKeystrokes(boolean echoKeystrokes)
Set echo keystrokes flag.void
setEchoKeystrokes(boolean echoKeystrokes, boolean recursive)
Set echo keystrokes flag.void
setEnabled(boolean enabled)
Set enabled flag.void
setHeight(int height)
Change the height.void
setLayoutManager(LayoutManager layout)
Set the layout manager.void
setMouseStyle(java.lang.String mouseStyle)
Set the mouse pointer (cursor) style.void
setParent(TWidget newParent, boolean doClose)
Set this widget's parent to a different widget.protected void
setupForTWindow(TWindow window, int x, int y, int width, int height)
Backdoor access for TWindow's constructor.void
setVisible(boolean visible)
Set visible flag.void
setWidth(int width)
Change the width.void
setWindow(TWindow window)
Set this widget's window to a specific window.void
setX(int x)
Set X position.void
setY(int y)
Set Y position.TSplitPane
splitHorizontal(boolean newWidgetOnTop, TWidget newWidget)
Insert a horizontal split between this widget and parent, and optionally put another widget in the other side of the split.TSplitPane
splitVertical(boolean newWidgetOnLeft, TWidget newWidget)
Insert a vertical split between this widget and parent, and optionally put another widget in the other side of the split.void
switchWidget(boolean forward)
Switch the active widget with the next in the tab order.java.lang.String
toPrettyString()
Generate a string for this widget's hierarchy.java.lang.String
toPrettyString(java.lang.String prefix)
Generate a string for this widget's hierarchy.java.lang.String
toString()
Generate a human-readable string for this widget.void
vLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a vertical line from (x, y) to (x, y + n).
-
-
-
Constructor Detail
-
TWidget
protected TWidget()
Default constructor for subclasses.
-
TWidget
protected TWidget(TWidget parent)
Protected constructor.- Parameters:
parent
- parent widget
-
TWidget
protected TWidget(TWidget parent, int x, int y, int width, int height)
Protected constructor.- Parameters:
parent
- parent widgetx
- column relative to parenty
- row relative to parentwidth
- width of widgetheight
- height of widget
-
TWidget
protected TWidget(TWidget parent, boolean enabled)
Protected constructor used by subclasses that are disabled by default.- Parameters:
parent
- parent widgetenabled
- if true assume enabled
-
TWidget
protected TWidget(TWidget parent, boolean enabled, int x, int y, int width, int height)
Protected constructor used by subclasses that are disabled by default.- Parameters:
parent
- parent widgetenabled
- if true assume enabledx
- column relative to parenty
- row relative to parentwidth
- width of widgetheight
- height of widget
-
-
Method Detail
-
setupForTWindow
protected final void setupForTWindow(TWindow window, int x, int y, int width, int height)
Backdoor access for TWindow's constructor. ONLY TWindow USES THIS.- Parameters:
window
- the top-level windowx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of window
-
close
public void close()
Subclasses should override this method to cleanup resources. This is called by TWindow.onClose().
-
mouseWouldHit
public final boolean mouseWouldHit(TMouseEvent mouse)
Check if a mouse press/release event coordinate is contained in this widget.- Parameters:
mouse
- a mouse-based event- Returns:
- whether or not a mouse click would be sent to this widget
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Method that subclasses can override to handle keystrokes.- Parameters:
keypress
- keystroke event
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Method that subclasses can override to handle mouse button presses.- Parameters:
mouse
- mouse button event
-
onMouseUp
public void onMouseUp(TMouseEvent mouse)
Method that subclasses can override to handle mouse button releases.- Parameters:
mouse
- mouse button event
-
onMouseMotion
public void onMouseMotion(TMouseEvent mouse)
Method that subclasses can override to handle mouse movements.- Parameters:
mouse
- mouse motion event
-
onMouseDoubleClick
public void onMouseDoubleClick(TMouseEvent mouse)
Method that subclasses can override to handle mouse button double-clicks.- Parameters:
mouse
- mouse button event
-
onResize
public void onResize(TResizeEvent resize)
Method that subclasses can override to handle window/screen resize events.- Parameters:
resize
- resize event
-
onCommand
public void onCommand(TCommandEvent command)
Method that subclasses can override to handle posted command events.- Parameters:
command
- command event
-
onMenu
public void onMenu(TMenuEvent menu)
Method that subclasses can override to handle menu or posted menu events.- Parameters:
menu
- menu event
-
onIdle
public void onIdle()
Method that subclasses can override to do processing when the UI is idle. Note that repainting is NOT assumed. To get a refresh after onIdle, call doRepaint().
-
handleEvent
public void handleEvent(TInputEvent event)
Consume event. Subclasses that want to intercept all events in one go can override this method.- Parameters:
event
- keyboard, mouse, resize, command, or menu event
-
getParent
public final TWidget getParent()
Get parent widget.- Returns:
- parent widget
-
getChildren
public java.util.List<TWidget> getChildren()
Get the list of child widgets that this widget contains.- Returns:
- the list of child widgets
-
remove
public final void remove()
Remove this widget from its parent container. close() will be called before it is removed.
-
remove
public final void remove(boolean doClose)
Remove this widget from its parent container.- Parameters:
doClose
- if true, call the close() method before removing the child
-
remove
public final void remove(TWidget child)
Remove a child widget from this container.- Parameters:
child
- the child widget to remove
-
remove
public final void remove(TWidget child, boolean doClose)
Remove a child widget from this container.- Parameters:
child
- the child widget to removedoClose
- if true, call the close() method before removing the child
-
hasChild
public boolean hasChild(TWidget child)
See if a widget is a child of this widget.- Parameters:
child
- the child widget- Returns:
- true if child is one of this widget's children
-
setParent
public final void setParent(TWidget newParent, boolean doClose)
Set this widget's parent to a different widget.- Parameters:
newParent
- new parent widgetdoClose
- if true, call the close() method before removing the child from its existing parent widget
-
setWindow
public final void setWindow(TWindow window)
Set this widget's window to a specific window. Having a null parent with a specified window is only used within Jexer by TStatusBar because TApplication routes events directly to it and calls its draw() method. Any other non-parented widgets will require similar special case functionality to receive events or be drawn to screen.- Parameters:
window
- the window to use
-
removeAll
public final void removeAll(TWidget child, boolean doClose)
Remove a child widget from this container, and all of its children recursively from their parent containers.- Parameters:
child
- the child widget to removedoClose
- if true, call the close() method before removing each child
-
isActive
public final boolean isActive()
Get active flag.- Returns:
- if true, this widget will receive events
-
setActive
public final void setActive(boolean active)
Set active flag.- Parameters:
active
- if true, this widget will receive events
-
getWindow
public final TWindow getWindow()
Get the window this widget is on.- Returns:
- the window
-
getX
public final int getX()
Get X position.- Returns:
- absolute X position of the top-left corner
-
setX
public final void setX(int x)
Set X position.- Parameters:
x
- absolute X position of the top-left corner
-
getY
public final int getY()
Get Y position.- Returns:
- absolute Y position of the top-left corner
-
setY
public final void setY(int y)
Set Y position.- Parameters:
y
- absolute Y position of the top-left corner
-
getWidth
public int getWidth()
Get the width.- Returns:
- widget width
-
setWidth
public void setWidth(int width)
Change the width.- Parameters:
width
- new widget width
-
getHeight
public int getHeight()
Get the height.- Returns:
- widget height
-
setHeight
public void setHeight(int height)
Change the height.- Parameters:
height
- new widget height
-
setDimensions
public final void setDimensions(int x, int y, int width, int height)
Change the dimensions.- Parameters:
x
- absolute X position of the top-left cornery
- absolute Y position of the top-left cornerwidth
- new widget widthheight
- new widget height
-
getLayoutManager
public LayoutManager getLayoutManager()
Get the layout manager.- Returns:
- the layout manager, or null if not set
-
setLayoutManager
public void setLayoutManager(LayoutManager layout)
Set the layout manager.- Parameters:
layout
- the new layout manager
-
isEnabled
public final boolean isEnabled()
Get enabled flag.- Returns:
- if true, this widget can be tabbed to or receive events
-
setEnabled
public final void setEnabled(boolean enabled)
Set enabled flag.- Parameters:
enabled
- if true, this widget can be tabbed to or receive events
-
setVisible
public final void setVisible(boolean visible)
Set visible flag.- Parameters:
visible
- if true, this widget will be drawn
-
isVisible
public final boolean isVisible()
See if this widget is visible.- Returns:
- if true, this widget will be drawn
-
setCursorVisible
public final void setCursorVisible(boolean cursorVisible)
Set visible cursor flag.- Parameters:
cursorVisible
- if true, this widget has a cursor
-
isCursorVisible
public final boolean isCursorVisible()
See if this widget has a visible cursor.- Returns:
- if true, this widget has a visible cursor
-
getCursorX
public final int getCursorX()
Get cursor X value.- Returns:
- cursor column position in relative coordinates
-
setCursorX
public final void setCursorX(int cursorX)
Set cursor X value.- Parameters:
cursorX
- column position in relative coordinates
-
getCursorY
public final int getCursorY()
Get cursor Y value.- Returns:
- cursor row position in relative coordinates
-
setCursorY
public final void setCursorY(int cursorY)
Set cursor Y value.- Parameters:
cursorY
- row position in relative coordinates
-
setEchoKeystrokes
public void setEchoKeystrokes(boolean echoKeystrokes)
Set echo keystrokes flag.- Parameters:
echoKeystrokes
- if true, this widget will echo keystrokes to all of its children
-
setEchoKeystrokes
public void setEchoKeystrokes(boolean echoKeystrokes, boolean recursive)
Set echo keystrokes flag.- Parameters:
echoKeystrokes
- if true, this widget will echo keystrokes to all of its childrenrecursive
- if true, set the echo keystrokes flag of all child widgets recursively
-
isEchoKeystrokes
public boolean isEchoKeystrokes()
Get echo keystrokes flag.- Returns:
- true if this widget echoes keystrokes to all of its children
-
getApplication
public TApplication getApplication()
Get this TWidget's parent TApplication.- Returns:
- the parent TApplication, or null if not assigned
-
getScreen
public Screen getScreen()
Get the Screen.- Returns:
- the Screen, or null if not assigned
-
getClipboard
public Clipboard getClipboard()
Get the Clipboard.- Returns:
- the Clipboard, or null if not assigned
-
compareTo
public int compareTo(TWidget that)
Comparison operator. For various subclasses it sorts on:- tabOrder for TWidgets
- z for TWindows
- text for TTreeItems
- Specified by:
compareTo
in interfacejava.lang.Comparable<TWidget>
- Parameters:
that
- another TWidget, TWindow, or TTreeItem instance- Returns:
- difference between this.tabOrder and that.tabOrder, or difference between this.z and that.z, or String.compareTo(text)
-
isAbsoluteActive
public final boolean isAbsoluteActive()
See if this widget is the active window within its hierarchy.- Returns:
- true if this widget is active and all of its parents are active.
-
getCursorAbsoluteX
public final int getCursorAbsoluteX()
Returns the cursor X position.- Returns:
- absolute screen column number for the cursor's X position
-
getCursorAbsoluteY
public final int getCursorAbsoluteY()
Returns the cursor Y position.- Returns:
- absolute screen row number for the cursor's Y position
-
getAbsoluteX
public final int getAbsoluteX()
Compute my absolute X position as the sum of my X plus all my parent's X's.- Returns:
- absolute screen column number for my X position
-
getAbsoluteY
public final int getAbsoluteY()
Compute my absolute Y position as the sum of my Y plus all my parent's Y's.- Returns:
- absolute screen row number for my Y position
-
getMouseStyle
public final java.lang.String getMouseStyle()
Get the mouse pointer (cursor) style.- Returns:
- the pointer style string, one of: "default", "none", "hand", "text", "move", or "crosshair"
-
setMouseStyle
public final void setMouseStyle(java.lang.String mouseStyle)
Set the mouse pointer (cursor) style. Currently this feature only works on the Swing backend. By contrast, custom mouse pointers work on all backends.- Parameters:
mouseStyle
- the pointer style string, one of: "default", "none", "hand", "text", "move", or "crosshair"
-
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.
-
isPixelMouse
public boolean isPixelMouse()
Check if per-pixel mouse events are requested.- Returns:
- true if per-pixel mouse events are requested
-
getTheme
public final ColorTheme getTheme()
Get the global color theme.- Returns:
- the ColorTheme
-
isDrawable
public final boolean isDrawable()
See if this widget can be drawn onto a screen.- Returns:
- true if this widget is part of the hierarchy that can draw to a screen
-
draw
public void draw()
Draw my specific widget. When called, the screen rectangle I draw into is already setup (offset and clipping).
-
drawChildren
public final void drawChildren()
Called by parent to render to TWindow.
-
doRepaint
protected final void doRepaint()
Repaint the screen on the next update.
-
resetTabOrder
protected void resetTabOrder()
Reset the tab order of children to match their position in the list. Available so that subclasses can re-order their widgets if needed.
-
activate
public final void activate(TWidget child)
Switch the active child.- Parameters:
child
- TWidget to activate
-
activate
public final void activate(int tabOrder)
Switch the active child.- Parameters:
tabOrder
- tabOrder of the child to activate. If that child isn't enabled, then the next enabled child will be activated.
-
activate
public void activate()
Make this widget the active child of its parent. Note that this is not final since TWindow overrides activate().
-
activateAll
public final void activateAll()
Make this widget, all of its parents, the active child.
-
switchWidget
public final void switchWidget(boolean forward)
Switch the active widget with the next in the tab order.- Parameters:
forward
- if true, then switch to the next enabled widget in the list, otherwise switch to the previous enabled widget in the list
-
getActiveChild
public TWidget getActiveChild()
Returns my active widget.- Returns:
- widget that is active, or this if no children
-
getWidgetUnderMouse
public TWidget getWidgetUnderMouse(TMouseEvent mouse)
Returns the widget under the mouse.- Parameters:
mouse
- the mouse position- Returns:
- widget that is under the mouse, or null if the mouse is not over this widget
-
splitVertical
public TSplitPane splitVertical(boolean newWidgetOnLeft, TWidget newWidget)
Insert a vertical split between this widget and parent, and optionally put another widget in the other side of the split.- Parameters:
newWidgetOnLeft
- if true, the new widget (if specified) will be on the left pane, and this widget will be placed on the right panenewWidget
- the new widget to add to the other pane, or null- Returns:
- the new split pane widget
-
splitHorizontal
public TSplitPane splitHorizontal(boolean newWidgetOnTop, TWidget newWidget)
Insert a horizontal split between this widget and parent, and optionally put another widget in the other side of the split.- Parameters:
newWidgetOnTop
- if true, the new widget (if specified) will be on the top pane, and this widget's children will be placed on the bottom panenewWidget
- the new widget to add to the other pane, or null- Returns:
- the new split pane widget
-
toString
public java.lang.String toString()
Generate a human-readable string for this widget.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a human-readable string
-
toPrettyString
public java.lang.String toPrettyString(java.lang.String prefix)
Generate a string for this widget's hierarchy.- Parameters:
prefix
- a prefix to use for this widget's place in the hierarchy- Returns:
- a pretty-printable string of this hierarchy
-
toPrettyString
public java.lang.String toPrettyString()
Generate a string for this widget's hierarchy.- Returns:
- a pretty-printable string of this hierarchy
-
getAttrXY
public final CellAttributes getAttrXY(int x, int y)
Get the attributes at one location.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.- Returns:
- attributes at (x, y)
-
putAttrXY
public final void putAttrXY(int x, int y, CellAttributes attr)
Set the attributes at one location.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.attr
- attributes to use (bold, foreColor, backColor)
-
putAttrXY
public final void putAttrXY(int x, int y, CellAttributes attr, boolean clip)
Set the attributes at one location.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.attr
- attributes to use (bold, foreColor, backColor)clip
- if true, honor clipping/offset
-
putAll
public final void putAll(int ch, CellAttributes attr)
Fill the entire screen with one character with attributes.- Parameters:
ch
- character to drawattr
- attributes to use (bold, foreColor, backColor)
-
putCharXY
public final void putCharXY(int x, int y, Cell ch)
Render one character with attributes.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.ch
- character + attributes to draw
-
putCharXY
public final void putCharXY(int x, int y, int ch, CellAttributes attr)
Render one character with attributes.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.ch
- character to drawattr
- attributes to use (bold, foreColor, backColor)
-
putCharXY
public final void putCharXY(int x, int y, int ch)
Render one character without changing the underlying attributes.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.ch
- character to draw
-
putStringXY
public final void putStringXY(int x, int y, java.lang.String str, CellAttributes attr)
Render a string. Does not wrap if the string exceeds the line.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.str
- string to drawattr
- attributes to use (bold, foreColor, backColor)
-
putStringXY
public final void putStringXY(int x, int y, java.lang.String str)
Render a string without changing the underlying attribute. Does not wrap if the string exceeds the line.- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.str
- string to draw
-
vLineXY
public final void vLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a vertical line from (x, y) to (x, y + n).- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.n
- number of characters to drawch
- character to drawattr
- attributes to use (bold, foreColor, backColor)
-
hLineXY
public final void hLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a horizontal line from (x, y) to (x + n, y).- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.n
- number of characters to drawch
- character to drawattr
- attributes to use (bold, foreColor, backColor)
-
drawBox
public final void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)
Draw a box with a border and empty background.- Parameters:
left
- left column of box. 0 is the left-most row.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxborder
- attributes to use for the borderbackground
- attributes to use for the background
-
drawBox
public final void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, int borderType, boolean shadow)
Draw a box with a border and empty background.- Parameters:
left
- left column of box. 0 is the left-most row.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxborder
- attributes to use for the borderbackground
- attributes to use for the backgroundborderType
- if 1, draw a single-line border; if 2, draw a double-line border; if 3, draw double-line top/bottom edges and single-line left/right edges (like Qmodem)shadow
- if true, draw a "shadow" on the box
-
drawBoxShadow
public final void drawBoxShadow(int left, int top, int right, int bottom)
Draw a box shadow.- Parameters:
left
- left column of box. 0 is the left-most row.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the box
-
addLabel
public final TLabel addLabel(java.lang.String text, int x, int y)
Convenience function to add a label to this container/window.- Parameters:
text
- labelx
- column relative to parenty
- row relative to parent- Returns:
- the new label
-
addLabel
public final TLabel addLabel(java.lang.String text, int x, int y, TAction action)
Convenience function to add a label to this container/window.- Parameters:
text
- labelx
- column relative to parenty
- row relative to parentaction
- to call when shortcut is pressed- Returns:
- the new label
-
addLabel
public final TLabel addLabel(java.lang.String text, int x, int y, java.lang.String colorKey)
Convenience function to add a label to this container/window.- Parameters:
text
- labelx
- column relative to parenty
- row relative to parentcolorKey
- ColorTheme key color to use for foreground text. Default is "tlabel"- Returns:
- the new label
-
addLabel
public final TLabel addLabel(java.lang.String text, int x, int y, java.lang.String colorKey, TAction action)
Convenience function to add a label to this container/window.- Parameters:
text
- labelx
- column relative to parenty
- row relative to parentcolorKey
- ColorTheme key color to use for foreground text. Default is "tlabel"action
- to call when shortcut is pressed- Returns:
- the new label
-
addLabel
public final TLabel addLabel(java.lang.String text, int x, int y, java.lang.String colorKey, boolean useWindowBackground)
Convenience function to add a label to this container/window.- Parameters:
text
- labelx
- column relative to parenty
- row relative to parentcolorKey
- ColorTheme key color to use for foreground text. Default is "tlabel"useWindowBackground
- if true, use the window's background color- Returns:
- the new label
-
addLabel
public final TLabel addLabel(java.lang.String text, int x, int y, java.lang.String colorKey, boolean useWindowBackground, TAction action)
Convenience function to add a label to this container/window.- Parameters:
text
- labelx
- column relative to parenty
- row relative to parentcolorKey
- ColorTheme key color to use for foreground text. Default is "tlabel"useWindowBackground
- if true, use the window's background coloraction
- to call when shortcut is pressed- Returns:
- the new label
-
addButton
public final TButton addButton(java.lang.String text, int x, int y, TAction action)
Convenience function to add a button to this container/window.- Parameters:
text
- label on the buttonx
- column relative to parenty
- row relative to parentaction
- action to call when button is pressed- Returns:
- the new button
-
addCheckBox
public final TCheckBox addCheckBox(int x, int y, java.lang.String label, boolean checked)
Convenience function to add a checkbox to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentlabel
- label to display next to (right of) the checkboxchecked
- initial check state- Returns:
- the new checkbox
-
addCheckBox
public final TCheckBox addCheckBox(int x, int y, java.lang.String label, boolean checked, TAction action)
Convenience function to add a checkbox to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentlabel
- label to display next to (right of) the checkboxchecked
- initial check stateaction
- the action to perform when the checkbox is toggled- Returns:
- the new checkbox
-
addComboBox
public final TComboBox addComboBox(int x, int y, int width, java.util.List<java.lang.String> values, int valuesIndex, int maxValuesHeight, TAction updateAction)
Convenience function to add a combobox to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible combobox width, including the down-arrowvalues
- the possible values for the box, shown in the drop-downvaluesIndex
- the initial index in values, or -1 for no default valuemaxValuesHeight
- the maximum height of the values drop-down when it is visibleupdateAction
- action to call when a new value is selected from the list or enter is pressed in the edit field- Returns:
- the new combobox
-
addSpinner
public final TSpinner addSpinner(int x, int y, TAction upAction, TAction downAction)
Convenience function to add a spinner to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentupAction
- action to call when the up arrow is clicked or presseddownAction
- action to call when the down arrow is clicked or pressed- Returns:
- the new spinner
-
addCalendar
public final TCalendar addCalendar(int x, int y, TAction updateAction)
Convenience function to add a calendar to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentupdateAction
- action to call when the user changes the value of the calendar- Returns:
- the new calendar
-
addProgressBar
public final TProgressBar addProgressBar(int x, int y, int width, int value)
Convenience function to add a progress bar to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of progress barvalue
- initial value of percent complete- Returns:
- the new progress bar
-
addRadioGroup
public final TRadioGroup addRadioGroup(int x, int y, java.lang.String label)
Convenience function to add a radio button group to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentlabel
- label to display on the group box- Returns:
- the new radio button group
-
addRadioGroup
public final TRadioGroup addRadioGroup(int x, int y, int width, java.lang.String label)
Convenience function to add a radio button group to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of grouplabel
- label to display on the group box
-
addField
public final TField addField(int x, int y, int width, boolean fixed)
Convenience function to add a text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display width- Returns:
- the new text field
-
addField
public final TField addField(int x, int y, int width, boolean fixed, java.lang.String text)
Convenience function to add a text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display widthtext
- initial text, default is empty string- Returns:
- the new text field
-
addField
public final TField addField(int x, int y, int width, boolean fixed, java.lang.String text, TAction enterAction)
Convenience function to add a text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display widthtext
- initial text, default is empty stringenterAction
- function to call when enter key is pressed- Returns:
- the new text field
-
addField
public final TField addField(int x, int y, int width, boolean fixed, java.lang.String text, TAction enterAction, TAction updateAction)
Convenience function to add a text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display widthtext
- initial text, default is empty stringenterAction
- function to call when enter key is pressedupdateAction
- function to call when the text is updated- Returns:
- the new text field
-
addText
public final TText addText(java.lang.String text, int x, int y, int width, int height, java.lang.String colorKey)
Convenience function to add a scrollable text box to this container/window.- Parameters:
text
- text on the screenx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areacolorKey
- ColorTheme key color to use for foreground text- Returns:
- the new text box
-
addText
public final TText addText(java.lang.String text, int x, int y, int width, int height)
Convenience function to add a scrollable text box to this container/window.- Parameters:
text
- text on the screenx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area- Returns:
- the new text box
-
addEditor
public final TEditorWidget addEditor(java.lang.String text, int x, int y, int width, int height)
Convenience function to add an editable text area box to this container/window.- Parameters:
text
- text on the screenx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area- Returns:
- the new text box
-
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
-
addPasswordField
public final TPasswordField addPasswordField(int x, int y, int width, boolean fixed)
Convenience function to add a password text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display width- Returns:
- the new text field
-
addPasswordField
public final TPasswordField addPasswordField(int x, int y, int width, boolean fixed, java.lang.String text)
Convenience function to add a password text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display widthtext
- initial text, default is empty string- Returns:
- the new text field
-
addPasswordField
public final TPasswordField addPasswordField(int x, int y, int width, boolean fixed, java.lang.String text, TAction enterAction, TAction updateAction)
Convenience function to add a password text field to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- visible text widthfixed
- if true, the text cannot exceed the display widthtext
- initial text, default is empty stringenterAction
- function to call when enter key is pressedupdateAction
- function to call when the text is updated- Returns:
- the new text field
-
addTreeViewWidget
public final TTreeViewWidget addTreeViewWidget(int x, int y, int width, int height)
Convenience function to add a scrollable tree view to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of tree viewheight
- height of tree view- Returns:
- the new tree view
-
addTreeViewWidget
public final TTreeViewWidget addTreeViewWidget(int x, int y, int width, int height, TAction action)
Convenience function to add a scrollable tree view to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of tree viewheight
- height of tree viewaction
- action to perform when an item is selected- Returns:
- the new tree view
-
fileOpenBox
public final java.lang.String fileOpenBox(java.lang.String path) throws java.io.IOException
Convenience function to spawn a file open 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
-
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
-
fileOpenBox
public final java.lang.String fileOpenBox(java.lang.String path, TFileOpenBox.Type type) throws java.io.IOException
Convenience function to spawn a 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 a 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 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.IOException
Convenience 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
-
addDirectoryList
public final TDirectoryList addDirectoryList(java.lang.String path, int x, int y, int width, int height)
Convenience function to add a directory list to this container/window.- Parameters:
path
- directory path, must be a directoryx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area- Returns:
- the new directory list
-
addDirectoryList
public final TDirectoryList addDirectoryList(java.lang.String path, int x, int y, int width, int height, TAction action)
Convenience function to add a directory list to this container/window.- Parameters:
path
- directory path, must be a directoryx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areaaction
- action to perform when an item is selected (enter or double-click)- Returns:
- the new directory list
-
addDirectoryList
public final TDirectoryList addDirectoryList(java.lang.String path, int x, int y, int width, int height, TAction action, TAction singleClickAction)
Convenience function to add a directory list to this container/window.- Parameters:
path
- directory path, must be a directoryx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areaaction
- action to perform when an item is selected (enter or double-click)singleClickAction
- action to perform when an item is selected (single-click)- Returns:
- the new directory list
-
addDirectoryList
public final TDirectoryList addDirectoryList(java.lang.String path, int x, int y, int width, int height, TAction action, TAction singleClickAction, java.util.List<java.lang.String> filters)
Convenience function to add a directory list to this container/window.- Parameters:
path
- directory path, must be a directoryx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areaaction
- action to perform when an item is selected (enter or double-click)singleClickAction
- action to perform when an item is selected (single-click)filters
- a list of strings that files must match to be displayed- Returns:
- the new directory list
-
addList
public final TList addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height)
Convenience function to add a list to this container/window.- Parameters:
strings
- list of strings to showx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area- Returns:
- the new directory list
-
addList
public final TList addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction)
Convenience function to add a list to this container/window.- Parameters:
strings
- list of strings to showx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areaenterAction
- action to perform when an item is selected- Returns:
- the new directory list
-
addList
public final TList addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction, TAction moveAction)
Convenience function to add a list to this container/window.- Parameters:
strings
- list of strings to showx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areaenterAction
- action to perform when an item is selectedmoveAction
- action to perform when the user navigates to a new item with arrow/page keys- Returns:
- the new directory list
-
addList
public TList addList(java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction, TAction moveAction, TAction singleClickAction)
Convenience function to add a list to this container/window.- Parameters:
strings
- list of strings to show. This is allowed to be null and set later with setList() or by subclasses.x
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areaenterAction
- action to perform when an item is selectedmoveAction
- action to perform when the user navigates to a new item with arrow/page keyssingleClickAction
- action to perform when the user clicks on an item
-
addImage
public final TImage addImage(int x, int y, int width, int height, java.awt.image.BufferedImage image, int left, int top)
Convenience function to add an image to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- number of text cells for width of the imageheight
- number of text cells for height of the imageimage
- the image to displayleft
- left column of the image. 0 is the left-most column.top
- top row of the image. 0 is the top-most row.
-
addImage
public final TImage addImage(int x, int y, int width, int height, java.awt.image.BufferedImage image, int left, int top, TAction clickAction)
Convenience function to add an image to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- number of text cells for width of the imageheight
- number of text cells for height of the imageimage
- the image to displayleft
- left column of the image. 0 is the left-most column.top
- top row of the image. 0 is the top-most row.clickAction
- function to call when mouse is pressed
-
addTable
public TTableWidget addTable(int x, int y, int width, int height)
Convenience function to add an editable 2D data table to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of widgetheight
- height of widget
-
addTable
public TTableWidget addTable(int x, int y, int width, int height, int gridColumns, int gridRows)
Convenience function to add an editable 2D data table to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of widgetheight
- height of widgetgridColumns
- number of columns in gridgridRows
- number of rows in grid
-
addPanel
public final TPanel addPanel(int x, int y, int width, int height)
Convenience function to add a panel to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area- Returns:
- the new panel
-
addSplitPane
public final TSplitPane addSplitPane(int x, int y, int width, int height, boolean vertical)
Convenience function to add a split pane to this container/window.- Parameters:
x
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areavertical
- if true, split vertically- Returns:
- the new split pane
-
-