Class SWORDComboBox

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

public class SWORDComboBox extends JComboBox
An extension of the JComboBox class. This adds a method that can update the list of items with the item. The update will only work on combo boxes that are set to editable.
Author:
Neil Taylor
See Also:
  • Constructor Details

    • SWORDComboBox

      public SWORDComboBox()
      Create an instance of the SWORD Combo box.
  • Method Details

    • updateList

      public void updateList()
      Update the list for the Combo box with the currently selected item. This will only add an item to the list if: i) the control is editable, ii) the selected item is not empty and iii) the item is not already in the list.
    • insertItem

      public void insertItem(Object newItem)
      Insert an item into the combo box. This will only be added if the item is not already present in the combo box.
      Parameters:
      newItem - The item to insert.
    • insertItems

      public void insertItems(String[] items)
      Insert multiple items into the combo box.
      Parameters:
      items - The array of items.
    • getText

      public String getText()
      Get the text of the currently selected item in the combo box.
      Returns:
      The text. null is returned if no item is selected.