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()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTButton.StyleAvailable styles of the button.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispatch()Act as though the button was pressed.voiddraw()Draw a button with a shadow.MnemonicStringgetMnemonic()Get the mnemonic string for this button.voidonKeypress(TKeypressEvent keypress)Handle keystrokes.voidonMouseDown(TMouseEvent mouse)Handle mouse button presses.voidonMouseMotion(TMouseEvent mouse)Handle mouse movements.voidonMouseUp(TMouseEvent mouse)Handle mouse button releases.voidsetEnabled(boolean enabled)Override TWidget.setActive() so that the button ends are redrawn.voidsetHeight(int height)Override TWidget's height: we can only set height at construction time.voidsetShadowColor(CellAttributes color)Set the background color used for the button "shadow".voidsetStyle(java.lang.String buttonStyle)Set the button style.voidsetStyle(TButton.Style style)Set the button style.voidsetWidth(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, 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, getLocale, getMouseStyle, getParent, getScreen, getTheme, getWidgetUnderMouse, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, 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, setLayoutManager, setLocale, setMouseStyle, setParent, setupForTWindow, setVisible, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY, vLineXY
-
-
-
-
Method Detail
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse button presses.- Overrides:
onMouseDownin 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:
onMouseMotionin classTWidget- Parameters:
mouse- mouse motion event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypressin classTWidget- Parameters:
keypress- keystroke event
-
setEnabled
public void setEnabled(boolean enabled)
Override TWidget.setActive() so that the button ends are redrawn.- Overrides:
setEnabledin classTWidget- Parameters:
enabled- if true, this widget can be tabbed to or receive events
-
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
-
setStyle
public void setStyle(TButton.Style style)
Set the button style.- Parameters:
style- SQUARE, ROUND, etc.
-
setStyle
public void setStyle(java.lang.String buttonStyle)
Set the button style.- Parameters:
buttonStyle- the button style string, one of: "square", "round", "diamond", "leftArrow", or "rightArrow"; or null to use the value from jexer.TButton.style.
-
-