Class CheckpointComboBox<E>

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

public class CheckpointComboBox<E> extends JComboBox<E>
Override of the basic JComboBox that adds the capacity to checkpoint its current value. Once the value is checkpoint, the hasChanged() method will reflect if the current value equals the checkpoint value or not.
Since:
3/21/14 8:34 AM
See Also:
  • Constructor Details

    • CheckpointComboBox

      public CheckpointComboBox()
      Default constructor.
    • CheckpointComboBox

      public CheckpointComboBox(E[] items)
      Constructor taking in a list of what items will be displayed in the combobox.
      Parameters:
      items - The items to be displayed in the combobox.
  • Method Details

    • checkpoint

      public void checkpoint()
      Checkpoints the combobox's current state by saving the value of its current index.
    • hasChanged

      public boolean hasChanged()
      Returns:
      TRUE if the checkpoint() method has been called and the currently selected index does not match the checkpoint index.
    • getCheckpointIndex

      public int getCheckpointIndex()
      Returns:
      The current checkpoint index or -1 if the checkpoint() method has not been called.
    • getCheckpointItem

      public Object getCheckpointItem()
      Returns:
      The Object stored at the checkpoint index or NULL if the checkpoint() method has not been called.
    • removeCheckpoint

      public void removeCheckpoint()
      Removes the current checkpoint by resetting the checkpoint index to -1.
    • getMaximumSize

      public Dimension getMaximumSize()
      Overrides:
      getMaximumSize in class JComponent