📄 undoablejcheckboxedit.java
字号:
import javax.swing.*;import javax.swing.undo.*;public class UndoableJCheckBoxEdit extends AbstractUndoableEdit{/* The UndoableJCheckBoxEdit class defines two variables, an *//* UndoableJCheckBox which serves as a reference to the object *//* that generated the event and a boolean which represents the *//* selected state of the event source. */ private boolean selected; private UndoableJCheckBox jcb;/* The UndoableJCheckBoxEdit constructor is passed a reference *//* to the object that generated the event. The selected variable *//* is set based on the selected state of the event source. */ public UndoableJCheckBoxEdit(UndoableJCheckBox checkbox) { jcb = checkbox; selected = jcb.isSelected(); }/* The redo() method is overridden to include a change to the *//* selected state of the event source. */ public void redo() throws CannotRedoException { super.redo(); jcb.setSelected(selected); }/* The undo() method is overridden to include a change to the *//* selected state of the event source. */ public void undo() throws CannotRedoException { super.undo(); jcb.setSelected(!selected); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -