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 checkpointed, the hasChanged() method will reflect if the current value equals the checkpointed 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 it's current index.
    • hasChanged

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

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

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

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

      public Dimension getMaximumSize()
      Overrides:
      getMaximumSize in class JComponent