public File[] selectImportFiles(final String title,boolean multipleSelection,FileNameExtensionFilter[] fileNameExtensionFilters){
  if (Boolean.parseBoolean(System.getProperty("use.native.choosers",Boolean.toString(OSType.isMac())))) {
    FileDialog importDialog=fileDialogs.get(title);
    if (importDialog == null) {
      importDialog=new FileDialog(this,title,FileDialog.LOAD);
      fileDialogs.put(title,importDialog);
    }
    importDialog.setVisible(true);
    if (importDialog.getFile() != null) {
      return new File[]{new File(importDialog.getDirectory(),importDialog.getFile())};
    }
  }
 else {
    JFileChooser importChooser=fileChoosers.get(title);
    if (importChooser == null) {
      importChooser=new JFileChooser(Utils.getCWD());
      importChooser.setMultiSelectionEnabled(multipleSelection);
      for (      FileNameExtensionFilter fileNameExtensionFilter : fileNameExtensionFilters) {
        importChooser.setFileFilter(fileNameExtensionFilter);
      }
      importChooser.setDialogTitle(title);
      fileChoosers.put(title,importChooser);
    }
    int returnVal=importChooser.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      if (importChooser.isMultiSelectionEnabled()) {
        return importChooser.getSelectedFiles();
      }
 else {
        return new File[]{importChooser.getSelectedFile()};
      }
    }
  }
  return null;
}

public File [ ] selectImportFiles ( final String title , boolean multipleSelection , FileNameExtensionFilter [ ] fileNameExtensionFilters ) { if ( Boolean . parseBoolean ( System . getProperty ( "use.native.choosers" , Boolean . toString ( OSType . isMac ( ) ) ) ) ) { FileDialog importDialog = fileDialogs . get ( title ) ; if ( importDialog == null ) { importDialog = new FileDialog ( this , title , FileDialog . LOAD ) ; fileDialogs . put ( title , importDialog ) ; } importDialog . setVisible ( true ) ; if ( importDialog . getFile ( ) != null ) { return new File [ ] { new File ( importDialog . getDirectory ( ) , importDialog . getFile ( ) ) } ; } } else { JFileChooser importChooser = fileChoosers . get ( title ) ; if ( importChooser == null ) { importChooser = new JFileChooser ( Utils . getCWD ( ) ) ; importChooser . setMultiSelectionEnabled ( multipleSelection ) ; for ( FileNameExtensionFilter fileNameExtensionFilter : fileNameExtensionFilters ) { importChooser . setFileFilter ( fileNameExtensionFilter ) ; } importChooser . setDialogTitle ( title ) ; fileChoosers . put ( title , importChooser ) ; } int returnVal = importChooser . showOpenDialog ( this ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { if ( importChooser . isMultiSelectionEnabled ( ) ) { return importChooser . getSelectedFiles ( ) ; } else { return new File [ ] { importChooser . getSelectedFile ( ) } ; } } } return null ; }
use the native file dialog on the mac because the swing one is bad . on linux , the native one is bad . no preference on windows .
