From a3c9ea9db5a8d02b1db4640809a2b4c825ed3245 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 23 Aug 2005 10:10:54 +0000 Subject: [PATCH] Is fileChooser instanceof Basic --- src/jalview/io/JalviewFileChooser.java | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 8050e97..7fffb80 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -62,27 +62,29 @@ public class JalviewFileChooser super.setFileFilter(filter); try{ - final javax.swing.plaf.basic.BasicFileChooserUI ui = (javax.swing.plaf.basic. - BasicFileChooserUI) getUI(); - final String name = ui.getFileName().trim(); - - if ( (name == null) || (name.length() == 0)) + if(getUI() instanceof javax.swing.plaf.basic.BasicFileChooserUI) { - return; - } + final javax.swing.plaf.basic.BasicFileChooserUI ui = (javax.swing.plaf. + basic.BasicFileChooserUI) getUI(); + final String name = ui.getFileName().trim(); - EventQueue.invokeLater(new Thread() - { - public void run() + if ( (name == null) || (name.length() == 0)) { - String currentName = ui.getFileName(); - if ( (currentName == null) || (currentName.length() == 0)) - { - ui.setFileName(name); - } + return; } - }); + EventQueue.invokeLater(new Thread() + { + public void run() + { + String currentName = ui.getFileName(); + if ( (currentName == null) || (currentName.length() == 0)) + { + ui.setFileName(name); + } + } + }); + } }catch(Exception ex) { // Some platforms do not have BasicFileChooserUI -- 1.7.10.2