Class BaseXList

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class BaseXList extends BaseXBack
Combination of text field and a list, communicating with each other. List entries are automatically completed if they match the first characters of the typed in text. Moreover, the cursor keys can be used to scroll through the list, and list entries can be chosen with mouse clicks.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
See Also:
  • Constructor Details

    • BaseXList

      public BaseXList(BaseXDialog dialog, String... choice)
      Default constructor.
      Parameters:
      dialog - dialog reference
      choice - the input values for the list
    • BaseXList

      public BaseXList(BaseXDialog dialog, boolean single, String... choice)
      Default constructor.
      Parameters:
      dialog - dialog reference
      single - only allow single choices
      choice - the input values for the list
  • Method Details

    • setValue

      public void setValue(String value)
      Chooses the specified value in the text field and list.
      Parameters:
      value - the value to be set
    • setEnabled

      public void setEnabled(boolean en)
      Overrides:
      setEnabled in class JComponent
    • isEnabled

      public boolean isEnabled()
      Overrides:
      isEnabled in class Component
    • setFont

      public void setFont(String font, int style)
      Sets the specified font.
      Parameters:
      font - font name
      style - style
    • getList

      public String[] getList()
      Returns all list choices.
      Returns:
      list index entry
    • getValue

      public String getValue()
      Returns the selected value of the text field. An empty string is returned if no or multiple values are selected.
      Returns:
      text field value
    • getValues

      public StringList getValues()
      Returns all selected values.
      Returns:
      text field value
    • getNum

      public int getNum()
      Returns the numeric representation of the user input. If the text field is invalid, the list entry is returned.
      Returns:
      numeric value
    • getIndex

      public int getIndex()
      Returns the current list index.
      Returns:
      list index entry
    • setSize

      public void setSize(int w, int h)
      Overrides:
      setSize in class Component
    • setWidth

      public void setWidth(int w)
      Sets the width of the component.
      Parameters:
      w - width
    • setData

      public void setData(String[] data)
      Resets the data shown in the list.
      Parameters:
      data - list data
    • requestFocusInWindow

      public boolean requestFocusInWindow()
      Overrides:
      requestFocusInWindow in class JComponent