/** * Display a file chooser dialog box. * * @param owner <code>Component</code> which 'owns' the dialog * @param mode Can be either <code>LOAD</code> or <code>SAVE</code> * @return The path to selected file, null otherwise */ public static String chooseFile(Component owner, int mode) { BuFileChooser chooser = new BuFileChooser(); if (mode == OPEN) chooser.setDialogType(JFileChooser.OPEN_DIALOG); else if (mode == SAVE) chooser.setDialogType(JFileChooser.SAVE_DIALOG); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileHidingEnabled(true); if (chooser.showDialog(owner, null) == JFileChooser.APPROVE_OPTION) return chooser.getSelectedFile() .getAbsolutePath(); return null; }
/** * Display a file chooser dialog box. * @param owner <code>Component</code> which 'owns' the dialog * @param mode Can be either <code>LOAD</code> or <code>SAVE</code> * @return The path to selected file, null otherwise */ public static String chooseFile(Component owner, int mode) { BuFileChooser chooser = new BuFileChooser(); if (mode == OPEN) chooser.setDialogType(JFileChooser.OPEN_DIALOG); else if (mode == SAVE) chooser.setDialogType(JFileChooser.SAVE_DIALOG); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileHidingEnabled(true); if (chooser.showDialog(owner, null) == JFileChooser.APPROVE_OPTION) return chooser.getSelectedFile().getAbsolutePath(); return null; }
bfc_ = new CtuluFileChooser(false); bfc_.setFileSelectionMode(fileChooserSelectionMode_); bfc_.setMultiSelectionEnabled(multipleSelection_); if ((baseDir_ == null) || (value_ == null)) {
private String getDirectory(String _default) { String r=FuLib.expandedPath(_default); // System.err.println("### FD begin"); BuFileChooser chooser=new BuFileChooser(); chooser.setDialogTitle(getS("Repertoire")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setFileHidingEnabled(true); chooser.setMultiSelectionEnabled(false); chooser.resetChoosableFileFilters(); File f=new File(r); if(f.exists()) chooser.setCurrentDirectory(f); int returnVal=chooser.showDialog(this,getS("Slectionner")); // System.err.println("### FD end"); if(returnVal == JFileChooser.APPROVE_OPTION) { f=chooser.getSelectedFile(); // System.err.println("### f="+f); if(f!=null) r=f.getPath(); } return FuLib.reducedPath(r); } }
private String getDirectory(String _default) { String r=FuLib.expandedPath(_default); // System.err.println("### FD begin"); BuFileChooser chooser=new BuFileChooser(); chooser.setDialogTitle(getS("Repertoire")); chooser.setFileSelectionMode(BuFileChooser.DIRECTORIES_ONLY); chooser.setFileHidingEnabled(true); chooser.setMultiSelectionEnabled(false); chooser.resetChoosableFileFilters(); File f=new File(r); if(f.exists()) chooser.setCurrentDirectory(f); int returnVal=chooser.showDialog(this,getS("Slectionner")); // System.err.println("### FD end"); if(returnVal == BuFileChooser.APPROVE_OPTION) { f=chooser.getSelectedFile(); // System.err.println("### f="+f); if(f!=null) r=f.getPath(); } return FuLib.reducedPath(r); } }
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileHidingEnabled(true); chooser.setMultiSelectionEnabled(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileHidingEnabled(true); chooser.setMultiSelectionEnabled(false);