Package jexer
Class TComboBox
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TComboBox
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw()
Draw the combobox down arrow.java.util.List<java.lang.String>
getList()
Get a copy of the list of strings to display.java.lang.String
getText()
Get combobox text value.void
hideList()
Hide the drop-down list.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse down clicks.void
setHeight(int height)
Override TWidget's height: we can only set height at construction time.void
setIndex(int index)
Set combobox text to one of the list values.void
setList(java.util.List<java.lang.String> list)
Set the new list of strings to display.void
setText(java.lang.String text)
Set combobox text value.void
setText(java.lang.String text, boolean caseSensitive)
Set combobox text value.void
setWidth(int width)
Override TWidget's width: we need to set child widget widths.void
showList()
Show the drop-down list.-
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, onMouseMotion, onMouseUp, 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
-
-
-
-
Constructor Detail
-
TComboBox
public TComboBox(TWidget parent, int x, int y, int width, java.util.List<java.lang.String> values, int valuesIndex, int maxValuesHeight, TAction updateAction)
Public constructor.- Parameters:
parent
- parent widgetx
- 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
-
-
Method Detail
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse down clicks.- Overrides:
onMouseDown
in classTWidget
- Parameters:
mouse
- mouse button down 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 need to set child widget widths.
-
setHeight
public void setHeight(int height)
Override TWidget's height: we can only set height at construction time.
-
hideList
public void hideList()
Hide the drop-down list.
-
showList
public void showList()
Show the drop-down list.
-
getText
public java.lang.String getText()
Get combobox text value.- Returns:
- text in the edit field
-
setText
public void setText(java.lang.String text)
Set combobox text value.- Parameters:
text
- the new text in the edit field
-
setText
public void setText(java.lang.String text, boolean caseSensitive)
Set combobox text value.- Parameters:
text
- the new text in the edit fieldcaseSensitive
- if true, perform a case-sensitive search for the list item
-
setIndex
public void setIndex(int index)
Set combobox text to one of the list values.- Parameters:
index
- the index in the list
-
getList
public final java.util.List<java.lang.String> getList()
Get a copy of the list of strings to display.- Returns:
- the list of strings
-
setList
public final void setList(java.util.List<java.lang.String> list)
Set the new list of strings to display.- Parameters:
list
- new list of strings
-
-