home *** CD-ROM | disk | FTP | other *** search
/ Australian PC Authority 1999 May / may1999.iso / May / JBUILDER / JSAMPLES.Z / Notepad$RedoAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-30  |  1.7 KB  |  38 lines

  1. import com.sun.java.swing.AbstractAction;
  2. import com.sun.java.swing.undo.CannotRedoException;
  3. import java.awt.event.ActionEvent;
  4.  
  5. class Notepad$RedoAction extends AbstractAction {
  6.    // $FF: synthetic field
  7.    private final Notepad this$0;
  8.  
  9.    public Notepad$RedoAction(Notepad var1) {
  10.       super("Redo");
  11.       this.this$0 = var1;
  12.       this.this$0 = var1;
  13.       ((AbstractAction)this).setEnabled(false);
  14.    }
  15.  
  16.    public void actionPerformed(ActionEvent var1) {
  17.       try {
  18.          this.this$0.undo.redo();
  19.       } catch (CannotRedoException var3) {
  20.          System.out.println("Unable to redo: " + var3);
  21.          ((Throwable)var3).printStackTrace();
  22.       }
  23.  
  24.       this.update();
  25.       Notepad.access$1(this.this$0).update();
  26.    }
  27.  
  28.    protected void update() {
  29.       if (this.this$0.undo.canRedo()) {
  30.          ((AbstractAction)this).setEnabled(true);
  31.          ((AbstractAction)this).putValue("Name", this.this$0.undo.getRedoPresentationName());
  32.       } else {
  33.          ((AbstractAction)this).setEnabled(false);
  34.          ((AbstractAction)this).putValue("Name", "Redo");
  35.       }
  36.    }
  37. }
  38.