home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.print;
-
- import java.awt.BorderLayout;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Frame;
- import java.io.File;
- import javax.swing.JDialog;
- import javax.swing.JFileChooser;
-
- class PrintDialog$SaveFileChooser extends JFileChooser {
- private JDialog dialog;
- private int returnValue;
- // $FF: synthetic field
- private final PrintDialog this$0;
-
- public PrintDialog$SaveFileChooser(PrintDialog var1, String var2) {
- super(var2);
- this.this$0 = var1;
- this.returnValue = -1;
- ((JFileChooser)this).setCurrentDirectory(new File(System.getProperty("user.dir", ".")));
- ((JFileChooser)this).setSelectedFile(new File(var2));
- }
-
- public int showDialog(Component var1, String var2) {
- if (var2 != null) {
- ((JFileChooser)this).setApproveButtonText(var2);
- ((JFileChooser)this).setDialogType(2);
- }
-
- String var3 = ((JFileChooser)this).getDialogTitle();
- if (var3 == null) {
- var3 = ((JFileChooser)this).getUI().getDialogTitle(this);
- }
-
- this.dialog = new JDialog((Frame)var1, var3, true);
- Container var4 = this.dialog.getContentPane();
- var4.setLayout(new BorderLayout());
- var4.add(this, "Center");
- this.dialog.pack();
- this.dialog.setLocationRelativeTo(var1);
- ((JFileChooser)this).rescanCurrentDirectory();
- this.dialog.show();
- return this.returnValue;
- }
-
- public void approveSelection() {
- this.returnValue = 0;
- super.approveSelection();
- this.dialog.dispose();
- }
-
- public void cancelSelection() {
- this.returnValue = 1;
- super.cancelSelection();
- this.dialog.dispose();
- }
-
- public String getFileName() {
- return ((JFileChooser)this).getSelectedFile().getAbsolutePath();
- }
- }
-