⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 undoablejcheckboxedit.java

📁 《java事件处理指南》一书的代码,好东西
💻 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 + -