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

📄 undoablejtogglebutton2.java

📁 java swing 开发代码
💻 JAVA
字号:
// UndoableJToggleButton2.java// Sample undoable toggle button class using UndoableEditSupport.// package	jswing.ch18;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import javax.swing.undo.*;public class UndoableJToggleButton2 extends JToggleButton {  private UndoableEditSupport support;  // For this example, we'll provide just one constructor.  public UndoableJToggleButton2(String txt) {    super(txt);    support = new UndoableEditSupport(this);  }  // Add an UndoableEditListener using our support object.  public void addUndoableEditListener(UndoableEditListener l) {    support.addUndoableEditListener(l);  }  // Remove an UndoableEditListener using our support object.  public void removeUndoableEditListener(UndoableEditListener l) {    support.addUndoableEditListener(l);  }  // Override this method to call the super implementation first (to fire the  // action event) and then fire a new UndoableEditEvent to our listeners using  // our support object.  protected void fireActionPerformed(ActionEvent ev) {    // Fire the ActionEvent as usual.    super.fireActionPerformed(ev);    support.postEdit(new UndoableToggleEdit(this));  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -