org.apache.uima.tools.util.gui
Class FileChooserBugWorkarounds

java.lang.Object
  extended by org.apache.uima.tools.util.gui.FileChooserBugWorkarounds

public class FileChooserBugWorkarounds
extends java.lang.Object

Workarounds for JFileChooser bugs on Windows Look and Feel. For a workaround for Java bug #4711700 ( http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4711700), Call fix() after setting Windows look and feel but before creating any file choosers.

To workaround intermittent exceptions thrown by JFileChooser.setCurrentDirectory() when it is called during initialization of your app, call the setCurrentDirectory(JFileChooser, File) method on this class rather than using the JFileChooser directly. This will use SwingUtilities.invokeLater to put the request on the event thread so it will not be executed until the event thread starts, thus avoiding the race condition hat otherwise occurs.


Constructor Summary
FileChooserBugWorkarounds()
           
 
Method Summary
static void fix()
          For workaround, call this method after setting Window look and feel but before creating any file choosers.
static void setCurrentDirectory(javax.swing.JFileChooser aFileChooser, java.io.File aDir)
          Call this to set the current directory of a JFileChooser, instead of using aFileChooser.setCurrentDirectory(aDir) directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileChooserBugWorkarounds

public FileChooserBugWorkarounds()
Method Detail

fix

public static void fix()
For workaround, call this method after setting Window look and feel but before creating any file choosers.


setCurrentDirectory

public static void setCurrentDirectory(javax.swing.JFileChooser aFileChooser,
                                       java.io.File aDir)
Call this to set the current directory of a JFileChooser, instead of using aFileChooser.setCurrentDirectory(aDir) directly.

Parameters:
aFileChooser - the JFileChooser on which to set the current directory
aDir - the directory to set


Copyright © 2012. All Rights Reserved.