Package jexer
Class TButton
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TButton
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
public class TButton extends TWidget
TButton implements a simple button. To make the button do something, pass a TAction class to its constructor.- See Also:
TAction.DO()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispatch()
Act as though the button was pressed.void
draw()
Draw a button with a shadow.MnemonicString
getMnemonic()
Get the mnemonic string for this button.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse button presses.void
onMouseMotion(TMouseEvent mouse)
Handle mouse movements.void
onMouseUp(TMouseEvent mouse)
Handle mouse button releases.void
setHeight(int height)
Override TWidget's height: we can only set height at construction time.void
setShadowColor(CellAttributes color)
Set the background color used for the button "shadow".void
setWidth(int width)
Override TWidget's width: we can only set width at construction time.-
Methods inherited from class jexer.TWidget
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getCustomMousePointer, getHeight, getLayoutManager, getMouseStyle, getParent, getScreen, getTheme, getWidgetUnderMouse, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isPixelMouse, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMenu, onMouseDoubleClick, onResize, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setCustomMousePointer, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setLayoutManager, setMouseStyle, setParent, setupForTWindow, setVisible, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
-
-
-
-
Method Detail
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse button presses.- Overrides:
onMouseDown
in classTWidget
- Parameters:
mouse
- mouse button event
-
onMouseUp
public void onMouseUp(TMouseEvent mouse)
Handle mouse button releases.
-
onMouseMotion
public void onMouseMotion(TMouseEvent mouse)
Handle mouse movements.- Overrides:
onMouseMotion
in classTWidget
- Parameters:
mouse
- mouse motion event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWidget
- Parameters:
keypress
- keystroke event
-
setWidth
public void setWidth(int width)
Override TWidget's width: we can only set width at construction time.
-
setHeight
public void setHeight(int height)
Override TWidget's height: we can only set height at construction time.
-
getMnemonic
public MnemonicString getMnemonic()
Get the mnemonic string for this button.- Returns:
- mnemonic string
-
dispatch
public void dispatch()
Act as though the button was pressed. This is useful for other UI elements to get the same action as if the user clicked the button.
-
setShadowColor
public void setShadowColor(CellAttributes color)
Set the background color used for the button "shadow". If null, no shadow will be drawn.- Parameters:
color
- the new background color, or null for no shadow
-
-