OptionPane invokeLater
authoramwaterhouse <Andrew Waterhouse>
Thu, 17 Aug 2006 13:51:56 +0000 (13:51 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 17 Aug 2006 13:51:56 +0000 (13:51 +0000)
src/jalview/io/FileLoader.java

index 10e0bf8..ac3c5d3 100755 (executable)
@@ -136,7 +136,7 @@ public class FileLoader
       }\r
       else\r
       {\r
-        String errorMessage = AppletFormatAdapter.SUPPORTED_FORMATS;\r
+        String error = AppletFormatAdapter.SUPPORTED_FORMATS;\r
 \r
         if (FormatAdapter.isValidFormat(format))\r
         {\r
@@ -146,7 +146,7 @@ public class FileLoader
           }\r
           catch (java.io.IOException ex)\r
           {\r
-            errorMessage = ex.getMessage();\r
+            error = ex.getMessage();\r
           }\r
         }\r
 \r
@@ -182,12 +182,18 @@ public class FileLoader
           if (Desktop.instance != null)\r
             Desktop.instance.stopLoading();\r
 \r
-          JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                                "Couldn't load file " + file +\r
-                                                "\n"\r
-                                                + errorMessage,\r
-                                                "Error loading file",\r
-                                                JOptionPane.WARNING_MESSAGE);\r
+          final String errorMessage = "Couldn't load file "+file+"\n"+error;\r
+\r
+          javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+          {\r
+            public void run()\r
+            {\r
+              JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                                    errorMessage,\r
+                                                    "Error loading file",\r
+                                                    JOptionPane.WARNING_MESSAGE);\r
+            }\r
+          });\r
         }\r
       }\r
 \r