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

  1. import com.sun.java.swing.text.Document;
  2. import com.sun.java.swing.text.PlainDocument;
  3. import java.awt.FileDialog;
  4. import java.awt.Frame;
  5. import java.awt.event.ActionEvent;
  6. import java.io.File;
  7.  
  8. class Notepad$OpenAction extends Notepad$NewAction {
  9.    // $FF: synthetic field
  10.    private final Notepad this$0;
  11.  
  12.    Notepad$OpenAction(Notepad var1) {
  13.       super(var1, "open");
  14.       this.this$0 = var1;
  15.       this.this$0 = var1;
  16.    }
  17.  
  18.    public void actionPerformed(ActionEvent var1) {
  19.       Frame var2 = this.this$0.getFrame();
  20.       if (this.this$0.fileDialog == null) {
  21.          this.this$0.fileDialog = new FileDialog(var2);
  22.       }
  23.  
  24.       this.this$0.fileDialog.setMode(0);
  25.       this.this$0.fileDialog.show();
  26.       String var3 = this.this$0.fileDialog.getFile();
  27.       if (var3 != null) {
  28.          String var4 = this.this$0.fileDialog.getDirectory();
  29.          File var5 = new File(var4, var3);
  30.          if (var5.exists()) {
  31.             Document var6 = this.this$0.getEditor().getDocument();
  32.             if (var6 != null) {
  33.                var6.removeUndoableEditListener(this.this$0);
  34.             }
  35.  
  36.             this.this$0.getEditor().setDocument(new PlainDocument());
  37.             var2.setTitle(var3);
  38.             Notepad$FileLoader var7 = new Notepad$FileLoader(this.this$0, var5, Notepad.access$2(this.this$0).getDocument());
  39.             ((Thread)var7).start();
  40.          }
  41.  
  42.       }
  43.    }
  44. }
  45.