Class JButtonGroupEdit

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.undo.UndoableEdit

    public class JButtonGroupEdit
    extends javax.swing.undo.AbstractUndoableEdit
    Class used to record the changes made to a JButtonGroup object which holds a list of JRadioButtons. This class is used to support an undo/redo functionality.

    Modified by: Joseph A. Huwaldt

    Version:
    September 16, 2012
    Author:
    Joseph A. Huwaldt Date: June 6, 2008
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      JButtonGroupEdit​(JButtonGroup btnGroup, java.lang.String presentationName)
      Construct an edit that records changes made to a JButtonGroup.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getPresentationName()
      Provides a localized, human readable description of this edit suitable for use in, say, a change log.
      javax.swing.JRadioButton newValue()
      Return the new button selected in the button group after the edit.
      javax.swing.JRadioButton originalValue()
      Return the original button selected in the button group before the edit.
      void redo()
      Re-apply the edit, assuming that it has been undone.
      void undo()
      Undo the edit that was made.
      • Methods inherited from class javax.swing.undo.AbstractUndoableEdit

        addEdit, canRedo, canUndo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JButtonGroupEdit

        public JButtonGroupEdit​(JButtonGroup btnGroup,
                                java.lang.String presentationName)
        Construct an edit that records changes made to a JButtonGroup. The originally selected button is the the button returned by the "getPreviousSelected()" method of JButtonGroup. The newly selected button is the button returned by the "getSelected()" method of JButtonGroup.
        Parameters:
        btnGroup - The radio button group being edited.
        presentationName - Brief, human readable, description of the edit.
    • Method Detail

      • originalValue

        public javax.swing.JRadioButton originalValue()
        Return the original button selected in the button group before the edit.
      • newValue

        public javax.swing.JRadioButton newValue()
        Return the new button selected in the button group after the edit.
      • undo

        public void undo()
                  throws javax.swing.undo.CannotUndoException
        Undo the edit that was made.
        Specified by:
        undo in interface javax.swing.undo.UndoableEdit
        Overrides:
        undo in class javax.swing.undo.AbstractUndoableEdit
        Throws:
        javax.swing.undo.CannotUndoException
      • redo

        public void redo()
                  throws javax.swing.undo.CannotRedoException
        Re-apply the edit, assuming that it has been undone.
        Specified by:
        redo in interface javax.swing.undo.UndoableEdit
        Overrides:
        redo in class javax.swing.undo.AbstractUndoableEdit
        Throws:
        javax.swing.undo.CannotRedoException
      • getPresentationName

        public java.lang.String getPresentationName()
        Provides a localized, human readable description of this edit suitable for use in, say, a change log.
        Specified by:
        getPresentationName in interface javax.swing.undo.UndoableEdit
        Overrides:
        getPresentationName in class javax.swing.undo.AbstractUndoableEdit