public class FileChooserBugWorkarounds extends Object
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 and Description |
---|
FileChooserBugWorkarounds() |
Modifier and Type | Method and Description |
---|---|
static void |
fix()
For workaround, call this method after setting Window look and feel but before creating any
file choosers.
|
static void |
setCurrentDirectory(JFileChooser aFileChooser,
File aDir)
Call this to set the current directory of a JFileChooser, instead of using
aFileChooser.setCurrentDirectory(aDir) directly.
|
public static void fix()
public static void setCurrentDirectory(JFileChooser aFileChooser, File aDir)
aFileChooser
- the JFileChooser on which to set the current directoryaDir
- the directory to setCopyright © 2018. All rights reserved.