Class EnumComboBox

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

public class EnumComboBox extends JComboBox
See Also:
  • Field Details Link icon

  • Constructor Details Link icon

    • EnumComboBox Link icon

      public EnumComboBox(EnumMap<?,String> enumMap, Enum<?> defaultKey)
      Create a combobox from an enum map.
      Parameters:
      enumMap - an EnumMapinvalid input: '<'enum, String>. The enum is the key, and the string, which will become the label, is the value.
      defaultKey - the enum that should default to "on".
    • EnumComboBox Link icon

      public EnumComboBox(EnumMap<?,String> enumMap, Enum<?> defaultKey, String extraChoice)
      Create a combobox from an enum map.
      Parameters:
      enumMap - an EnumMapinvalid input: '<'enum, String>. The enum is the key, and the string, which will become the label, is the value.
      defaultKey - the enum that should default to "on".
      extraChoice - an optional extra choice, like "None" or "Any"
  • Method Details Link icon

    • getSelectedEnum Link icon

      public Enum<?> getSelectedEnum()
      Get the enum corresponding to the selected string, which is the nice name of the enum.
      Returns:
      the selected enum value. Returns null if "extra choice" was used and selected.
    • sizeComboBox Link icon

      protected void sizeComboBox()