Interface ComboBoxModel

All Known Implementing Classes:
DefaultComboBoxModel

public interface ComboBoxModel
An interface describing a data store or model for a UIComboBox. The model should maintain a list of values for a combo box, as well as an optional tool tip and view String override.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(int index, Object value)
    Add a new item to at the specified index in our model.
    int
    addItem(Object value)
    Add a new item to the end of our model.
    void
    Removes all items from this model.
    getToolTipAt(int index)
     
    getValueAt(int index)
    Get the item value at the specified index.
    getViewAt(int index)
     
    void
    setToolTipAt(int index, String toolTip)
    Sets the tool tip for the given index.
    void
    setValueAt(int index, Object value)
    Sets the value of the item at the given index.
    void
    setViewAt(int index, String view)
    Sets the view String for the given index.
    int
     
  • Method Details

    • addItem

      int addItem(Object value)
      Add a new item to the end of our model.
      Parameters:
      value - the value to add. value.toString() is used for the view of this value by default.
      Returns:
      the index we were added at
      See Also:
    • addItem

      void addItem(int index, Object value)
      Add a new item to at the specified index in our model. Should pad with null entries if index > current max model index.
      Parameters:
      index - the index to add at
      value - the value to add
    • getValueAt

      Object getValueAt(int index)
      Get the item value at the specified index.
      Parameters:
      index - the index to retrieve
      Returns:
      the value of the item at the given index.
    • setValueAt

      void setValueAt(int index, Object value)
      Sets the value of the item at the given index. If that item already has a name or tooltip set, it is left unchanged.
      Parameters:
      index - the index to add at.
      value - the value to set
    • getViewAt

      String getViewAt(int index)
      Parameters:
      index - the index to retrieve
      Returns:
      the view String for the given index. If no specific view is set, the value at that location is converted with toString().
    • setViewAt

      void setViewAt(int index, String view)
      Sets the view String for the given index.
      Parameters:
      index - the index to add at.
      view - the view String to set
    • getToolTipAt

      String getToolTipAt(int index)
      Parameters:
      index - the index to retrieve
      Returns:
      the tool tip for the given index.
    • setToolTipAt

      void setToolTipAt(int index, String toolTip)
      Sets the tool tip for the given index.
      Parameters:
      index - the index to add at.
      toolTip - the tool tip to set
    • size

      int size()
      Returns:
      the number of items, including null items, in our model.
    • clear

      void clear()
      Removes all items from this model.