Class OSPCombo

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MenuElement

public class OSPCombo extends JPopupMenu
A JPopupMenu with String items from which to choose.
Author:
Doug Brown
See Also:
  • Field Details

    • items

      protected String[] items
    • selected

      protected int selected
  • Constructor Details

    • OSPCombo

      public OSPCombo(String[] choices, int initial)
      Constructor that specifies initial selected index.
      Parameters:
      choices - an array of string items
      initial - the initial selected index
    • OSPCombo

      public OSPCombo(String[] choices)
      Constructor that selects index 0.
      Parameters:
      choices - an array of string items
  • Method Details

    • getSelectedIndex

      public int getSelectedIndex()
      Returns the selected index.
      Returns:
      the selected index
    • getItems

      public String[] getItems()
      Returns the items String[].
      Returns:
      the items
    • showPopup

      public void showPopup(JTextField display)
      Shows the popup immediately below the specified field. If item is selected, sets the field text and fires property change.
      Parameters:
      field - the field that displays the selected string
    • toString

      public String toString()
      Returns the selected String.
      Overrides:
      toString in class Component
      Returns:
      the currently selected String
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader