home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / awt / print / PrintDialog$SaveFileChooser.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.0 KB  |  63 lines

  1. package sun.awt.print;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Frame;
  7. import java.io.File;
  8. import javax.swing.JDialog;
  9. import javax.swing.JFileChooser;
  10.  
  11. class PrintDialog$SaveFileChooser extends JFileChooser {
  12.    private JDialog dialog;
  13.    private int returnValue;
  14.    // $FF: synthetic field
  15.    private final PrintDialog this$0;
  16.  
  17.    public PrintDialog$SaveFileChooser(PrintDialog var1, String var2) {
  18.       super(var2);
  19.       this.this$0 = var1;
  20.       this.returnValue = -1;
  21.       ((JFileChooser)this).setCurrentDirectory(new File(System.getProperty("user.dir", ".")));
  22.       ((JFileChooser)this).setSelectedFile(new File(var2));
  23.    }
  24.  
  25.    public int showDialog(Component var1, String var2) {
  26.       if (var2 != null) {
  27.          ((JFileChooser)this).setApproveButtonText(var2);
  28.          ((JFileChooser)this).setDialogType(2);
  29.       }
  30.  
  31.       String var3 = ((JFileChooser)this).getDialogTitle();
  32.       if (var3 == null) {
  33.          var3 = ((JFileChooser)this).getUI().getDialogTitle(this);
  34.       }
  35.  
  36.       this.dialog = new JDialog((Frame)var1, var3, true);
  37.       Container var4 = this.dialog.getContentPane();
  38.       var4.setLayout(new BorderLayout());
  39.       var4.add(this, "Center");
  40.       this.dialog.pack();
  41.       this.dialog.setLocationRelativeTo(var1);
  42.       ((JFileChooser)this).rescanCurrentDirectory();
  43.       this.dialog.show();
  44.       return this.returnValue;
  45.    }
  46.  
  47.    public void approveSelection() {
  48.       this.returnValue = 0;
  49.       super.approveSelection();
  50.       this.dialog.dispose();
  51.    }
  52.  
  53.    public void cancelSelection() {
  54.       this.returnValue = 1;
  55.       super.cancelSelection();
  56.       this.dialog.dispose();
  57.    }
  58.  
  59.    public String getFileName() {
  60.       return ((JFileChooser)this).getSelectedFile().getAbsolutePath();
  61.    }
  62. }
  63.