Java Swing O Reilly implementation of the same (Web server hosting)
Java Swing O Reilly implementation of the same class), we’ll show how easily we can use UndoableEditSupport to allow multiple listeners to be added and notified. Differences from our earlier implementation are highlighted. import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.undo.*; // Sample undoable toggle button class using UndoableEditSupport. public class UndoableJToggleButton2 extends JToggleButton { // For this example, we’ll just provide 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)); } private UndoableEditSupport support; } 18.1.10 The CannotRedoException Class This class is an extension of RuntimeException thrown when an attempt is made to redo an UndoableEdit that cannot be redone (typically because it has not yet been undone, or because it has been “killed”). There are no properties, constructors (other than the implicit default), or methods defined in this class. - 574 -
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.