public static JFileChooser getDirectoryChooser ( String id ) { JFileChooser chooser ; Class < ? > directoryChooserClass ; try { directoryChooserClass = Class . forName ( "com.l2fprod.common.swing.JDirectoryChooser" ) ; chooser = ( JFileChooser ) directoryChooserClass . newInstance ( ) ; } catch ( ClassNotFoundException ex ) { chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; } catch ( InstantiationException ex ) { chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; } catch ( IllegalAccessException ex ) { chooser = new JFileChooser ( ) ; chooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; } track ( chooser , "DirectoryChooser." + id + ".path" ) ; return chooser ; }
Gets the directory chooser with the given id . Its current directory will be tracked and restored on subsequent calls .