Class IntSelector

All Implemented Interfaces:
ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class IntSelector extends JPanel implements ItemListener
Some sort of component which allows the user to select an integer. At time of writing this is only used in one context, but could be generalised for other uses, in which case it might need some less specific methods/constructors.
Since:
7 Oct 2004
Author:
Mark Taylor (Starlink)
See Also:
  • Constructor Details

    • IntSelector

      public IntSelector(int[] options)
      Constructs a new selector with a set of preselected options. Other options can be chosen by the user.
      Parameters:
      options - initial selections
  • Method Details

    • getValue

      public int getValue()
      Returns the currently selected value.
      Returns:
      selected integer
    • setValue

      public void setValue(int value)
      Sets the seleced value.
      Parameters:
      value - selected integer
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
    • getComboBox

      public JComboBox<Integer> getComboBox()
      Returns the combo box that forms the main part of this selector.
      Returns:
      combo box
    • itemStateChanged

      public void itemStateChanged(ItemEvent evt)
      Implements ItemListener interface, called when the selection is changed. This maintains the value of the currently selected value and validates it.
      Specified by:
      itemStateChanged in interface ItemListener