jdk/src/share/classes/javax/swing/JFileChooser.java
changeset 3982 b8872825ad04
parent 3346 1c65be97eaa2
child 5506 202f599c92aa
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Sep 23 21:14:53 2009 +0400
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Tue Oct 06 17:01:52 2009 +0400
@@ -715,7 +715,7 @@
      * <ul>
      * <li>JFileChooser.CANCEL_OPTION
      * <li>JFileChooser.APPROVE_OPTION
-     * <li>JFileCHooser.ERROR_OPTION if an error occurs or the
+     * <li>JFileChooser.ERROR_OPTION if an error occurs or the
      *                  dialog is dismissed
      * </ul>
      * @exception HeadlessException if GraphicsEnvironment.isHeadless()
@@ -724,6 +724,11 @@
      */
     public int showDialog(Component parent, String approveButtonText)
         throws HeadlessException {
+        if (dialog != null) {
+            // Prevent to show second instance of dialog if the previous one still exists
+            return JFileChooser.ERROR_OPTION;
+        }
+
         if(approveButtonText != null) {
             setApproveButtonText(approveButtonText);
             setDialogType(CUSTOM_DIALOG);