public class TList extends TScrollableWidget
Modifier and Type | Field and Description |
---|---|
protected TAction |
enterAction
The action to perform when the user selects an item (double-clicks or
enter).
|
protected TAction |
moveAction
The action to perform when the user navigates with keyboard.
|
protected TAction |
singleClickAction
The action to perform when the user selects an item (single-click).
|
hScroller, vScroller
Constructor and Description |
---|
TList(TWidget parent,
java.util.List<java.lang.String> strings,
int x,
int y,
int width,
int height)
Public constructor.
|
TList(TWidget parent,
java.util.List<java.lang.String> strings,
int x,
int y,
int width,
int height,
TAction enterAction)
Public constructor.
|
TList(TWidget parent,
java.util.List<java.lang.String> strings,
int x,
int y,
int width,
int height,
TAction enterAction,
TAction moveAction)
Public constructor.
|
TList(TWidget parent,
java.util.List<java.lang.String> strings,
int x,
int y,
int width,
int height,
TAction enterAction,
TAction moveAction,
TAction singleClickAction)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
dispatchEnter()
Perform user selection action.
|
void |
dispatchMove()
Perform list movement action.
|
void |
dispatchSingleClick()
Perform single-click action.
|
void |
draw()
Draw the list.
|
java.util.List<java.lang.String> |
getList()
Get a copy of the list of strings to display.
|
java.lang.String |
getListItem(int idx)
Get a selectable string by index.
|
int |
getMaxSelectedIndex()
Get the maximum selection index value.
|
java.lang.String |
getSelected()
Get the selected string.
|
int |
getSelectedIndex()
Get the selection index.
|
void |
onKeypress(TKeypressEvent keypress)
Handle keystrokes.
|
void |
onMouseDoubleClick(TMouseEvent mouse)
Handle mouse double click.
|
void |
onMouseDown(TMouseEvent mouse)
Handle mouse press events.
|
void |
reflowData()
Resize for a new width/height.
|
void |
setHeight(int height)
Override TWidget's height: we need to set child widget heights.
|
void |
setList(java.util.List<java.lang.String> list)
Set the new list of strings to display.
|
void |
setSelectedIndex(int index)
Set the selected string index.
|
void |
setWidth(int width)
Override TWidget's width: we need to set child widget widths.
|
bigHorizontalDecrement, bigHorizontalIncrement, bigVerticalDecrement, bigVerticalIncrement, getBottomValue, getHorizontalBigChange, getHorizontalScroller, getHorizontalSmallChange, getHorizontalValue, getLeftValue, getRightValue, getTopValue, getVerticalBigChange, getVerticalScroller, getVerticalSmallChange, getVerticalValue, horizontalDecrement, horizontalIncrement, onResize, placeScrollbars, setBottomValue, setHorizontalBigChange, setHorizontalSmallChange, setHorizontalValue, setLeftValue, setRightValue, setTopValue, setVerticalBigChange, setVerticalSmallChange, setVerticalValue, toBottom, toEnd, toHome, toLeft, toRight, toTop, verticalDecrement, verticalIncrement
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getScreen, getTheme, getWidth, getWindow, getX, getY, handleEvent, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMenu, onMouseMotion, onMouseUp, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEnabled, setLayoutManager, setParent, setupForTWindow, setVisible, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
protected TAction enterAction
protected TAction singleClickAction
protected TAction moveAction
public TList(TWidget parent, java.util.List<java.lang.String> strings, int x, int y, int width, int height)
parent
- parent widgetstrings
- list of strings to showx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areapublic TList(TWidget parent, java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction)
parent
- parent widgetstrings
- 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 selectedpublic TList(TWidget parent, java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction, TAction moveAction)
parent
- parent widgetstrings
- 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 keyspublic TList(TWidget parent, java.util.List<java.lang.String> strings, int x, int y, int width, int height, TAction enterAction, TAction moveAction, TAction singleClickAction)
parent
- parent widgetstrings
- 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
itempublic void onMouseDown(TMouseEvent mouse)
onMouseDown
in class TWidget
mouse
- mouse button press eventpublic void onMouseDoubleClick(TMouseEvent mouse)
onMouseDoubleClick
in class TWidget
mouse
- mouse double click eventpublic void onKeypress(TKeypressEvent keypress)
onKeypress
in class TWidget
keypress
- keystroke eventpublic void setWidth(int width)
public void setHeight(int height)
public void reflowData()
reflowData
in class TScrollableWidget
public final int getSelectedIndex()
public final void setSelectedIndex(int index)
index
- -1 to unselect, otherwise the index into the listpublic final java.lang.String getListItem(int idx)
idx
- index into listpublic final java.lang.String getSelected()
public final int getMaxSelectedIndex()
public final java.util.List<java.lang.String> getList()
public final void setList(java.util.List<java.lang.String> list)
list
- new list of stringspublic void dispatchEnter()
public void dispatchMove()
public void dispatchSingleClick()
Copyright © 2019 Kevin Lamonte. Licensed MIT.