Java Swing (Web site layout) O Reilly } private ExtendedUndoableEditSupport support

Java Swing O Reilly } private ExtendedUndoableEditSupport support = new ExtendedUndoableEditSupport(); private Object source; // the source of the last edit // A simple extension of UndoableEditSupport that lets us specify the event // source each time we post an edit. class ExtendedUndoableEditSupport extends UndoableEditSupport { // Post an edit to added listeners. public synchronized void postEdit(UndoableEdit ue) { realSource = source; // from our enclosing manager object super.postEdit(ue); } } } The first method here is a customized implementation of addEdit(). For the most part, we leave this method to the superclass. The only thing we’ve added is a call to UndoableEditSupport.postEdit(). Any time an edit is added to the undo manager, we’ll notify its listeners. The idea is that a single listener, probably responsible for updating an Undo menu, will be added to the undo manager. The next method is the undoableEditHappened() method from the UndoableEditListener interface. This is the method called each time any edit-generating component in the application fires an UndoableEdit. In this method, we first store the source of the event (we’ll see how we use this shortly) and then call addEdit(). The next two methods simply use UndoableEditSupport to manage interested listeners. Finally, we define a small inner class called ExtendedUndoableEditSupport. This is an extension of UndoableEditSupport that we will use to set the correct event source each time the ExtendedUndoManager fires an UndoableEditEvent. Rather than declaring the undo manager as the source of the event, we use the real source of the event that was passed to the undo manager’s undoableEditHappened() method. Note that realSource, which is a protected field in UndoableEditSupport, becomes the source object in the fired UndoableEdit-Event. - 577 -
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Leave a Reply