Class SelectableComboBox

All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, ListDataListener

public class SelectableComboBox extends JComboBox<Object>
A combobox adapted to show enabled/disabled items.
See Also:
  • Constructor Details Link icon

    • SelectableComboBox Link icon

      public SelectableComboBox()
      Constructor.
  • Method Details Link icon

    • addItem Link icon

      public void addItem(String str)
      Adds an enabled item into the combo box
      Parameters:
      str - Text of the item
    • addItem Link icon

      public void addItem(String str, boolean enabled)
      Adds an item into the combobox in either enabled or disabled state,
      Parameters:
      str - Text of the item
      enabled - The state
    • addItem Link icon

      public void addItem(Component ci)
      Add an existing item into the combobox.
      Parameters:
      ci - An existing item
    • setItem Link icon

      public void setItem(String str, boolean enabled)
      If the combobox contains str, sets its state to [@code bool}. If it's not yet an item, ignores it. The method also re-sets the selected item to the first one shown in the list as "true", and disables the listeners in this process to avoid firing an action when reorganizing the list.
      Parameters:
      str - Text of the existing item
      enabled - New state
    • getItems Link icon

      protected Object[] getItems()
    • firstTrueItem Link icon

      protected int firstTrueItem()
      Returns:
      -1 if no item is true