aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/JFileChooser.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/JFileChooser.java')
-rw-r--r--libjava/classpath/javax/swing/JFileChooser.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/libjava/classpath/javax/swing/JFileChooser.java b/libjava/classpath/javax/swing/JFileChooser.java
index 64f9bd0f..a508b8f 100644
--- a/libjava/classpath/javax/swing/JFileChooser.java
+++ b/libjava/classpath/javax/swing/JFileChooser.java
@@ -43,6 +43,8 @@ import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowAdapter;
import java.beans.PropertyChangeEvent;
import java.io.File;
import java.util.ArrayList;
@@ -351,7 +353,7 @@ public class JFileChooser extends JComponent implements Accessible
* The file selection mode.
* @see #setFileSelectionMode(int)
*/
- private int fileSelectionMode = FILES_AND_DIRECTORIES;
+ private int fileSelectionMode = FILES_ONLY;
/**
* The file view.
@@ -744,10 +746,16 @@ public class JFileChooser extends JComponent implements Accessible
JDialog dialog = new JDialog(toUse);
setSelectedFile(null);
dialog.getContentPane().add(this);
+ dialog.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent e)
+ {
+ cancelSelection();
+ }
+ });
dialog.setModal(true);
dialog.invalidate();
dialog.repaint();
-
return dialog;
}