home *** CD-ROM | disk | FTP | other *** search
- import com.sun.java.swing.AbstractAction;
- import com.sun.java.swing.text.Document;
- import java.awt.FileDialog;
- import java.awt.Frame;
- import java.awt.event.ActionEvent;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.ObjectInputStream;
-
- class Stylepad$OpenAction extends AbstractAction {
- // $FF: synthetic field
- private final Stylepad this$0;
-
- Stylepad$OpenAction(Stylepad var1) {
- super("open");
- this.this$0 = var1;
- this.this$0 = var1;
- }
-
- public void actionPerformed(ActionEvent var1) {
- Frame var2 = this.this$0.getFrame();
- if (this.this$0.fileDialog == null) {
- this.this$0.fileDialog = new FileDialog(var2);
- }
-
- this.this$0.fileDialog.setMode(0);
- this.this$0.fileDialog.show();
- String var3 = this.this$0.fileDialog.getFile();
- if (var3 != null) {
- String var4 = this.this$0.fileDialog.getDirectory();
- File var5 = new File(var4, var3);
- if (var5.exists()) {
- try {
- FileInputStream var6 = new FileInputStream(var5);
- ObjectInputStream var7 = new ObjectInputStream(var6);
- Document var8 = (Document)var7.readObject();
- this.this$0.getEditor().setDocument(var8);
- var2.setTitle(var3);
- this.this$0.validate();
- } catch (IOException var9) {
- System.err.println("IOException: " + ((Throwable)var9).getMessage());
- } catch (ClassNotFoundException var10) {
- System.err.println("Class not found: " + ((Throwable)var10).getMessage());
- }
- } else {
- System.err.println("No such file: " + var5);
- }
- }
- }
- }
-