From 6ddec2b963d01f867f19976cd5c6aa7d6b2dc88a Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 17 Aug 2006 13:51:56 +0000 Subject: [PATCH] OptionPane invokeLater --- src/jalview/io/FileLoader.java | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 10e0bf8..ac3c5d3 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -136,7 +136,7 @@ public class FileLoader } else { - String errorMessage = AppletFormatAdapter.SUPPORTED_FORMATS; + String error = AppletFormatAdapter.SUPPORTED_FORMATS; if (FormatAdapter.isValidFormat(format)) { @@ -146,7 +146,7 @@ public class FileLoader } catch (java.io.IOException ex) { - errorMessage = ex.getMessage(); + error = ex.getMessage(); } } @@ -182,12 +182,18 @@ public class FileLoader if (Desktop.instance != null) Desktop.instance.stopLoading(); - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "Couldn't load file " + file + - "\n" - + errorMessage, - "Error loading file", - JOptionPane.WARNING_MESSAGE); + final String errorMessage = "Couldn't load file "+file+"\n"+error; + + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + JOptionPane.showInternalMessageDialog(Desktop.desktop, + errorMessage, + "Error loading file", + JOptionPane.WARNING_MESSAGE); + } + }); } } -- 1.7.10.2