Package jexer

Class TComboBox

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TComboBox
    extends TWidget
    TComboBox implements a combobox containing a drop-down list and edit field. Alt-Down can be used to show the drop-down.
    • 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 widget
        x - column relative to parent
        y - row relative to parent
        width - visible combobox width, including the down-arrow
        values - the possible values for the box, shown in the drop-down
        valuesIndex - the initial index in values, or -1 for no default value
        maxValuesHeight - the maximum height of the values drop-down when it is visible
        updateAction - 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 class TWidget
        Parameters:
        mouse - mouse button down event
      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TWidget
        Parameters:
        keypress - keystroke event
      • setWidth

        public void setWidth​(int width)
        Override TWidget's width: we need to set child widget widths.
        Overrides:
        setWidth in class TWidget
        Parameters:
        width - new widget width
      • setHeight

        public void setHeight​(int height)
        Override TWidget's height: we can only set height at construction time.
        Overrides:
        setHeight in class TWidget
        Parameters:
        height - new widget height (ignored)
      • draw

        public void draw()
        Draw the combobox down arrow.
        Overrides:
        draw in class TWidget
      • 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 field
        caseSensitive - 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