Java JFileChooser createJFileChooser(String name)

Here you can find the source of createJFileChooser(String name)

Description

Returns a new JFileChooser properly set up for Tetrad.

License

Open Source License

Parameter

Parameter Description
name a parameter

Declaration

public static JFileChooser createJFileChooser(String name) 

Method Source Code


//package com.java2s;
// it under the terms of the GNU General Public License as published by      //

import javax.swing.*;

import java.io.File;

import java.util.prefs.Preferences;

public class Main {
    /**/*from   w w  w.  j a  v  a 2 s  .c  o m*/
     * Returns a new JFileChooser properly set up for Tetrad.
     *
     * @param name
     */
    public static JFileChooser createJFileChooser(String name) {
        if (name == null) {
            name = "Save";
        }

        JFileChooser chooser = new JFileChooser();
        String sessionSaveLocation = Preferences.userRoot().get("fileSaveLocation", "");
        chooser.setCurrentDirectory(new File(sessionSaveLocation));
        chooser.resetChoosableFileFilters();
        chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
        chooser.setDialogTitle(name);

        return chooser;
    }
}

Related

  1. correctSelectedFileExtension(JFileChooser chooser)
  2. createChooser(String lastPath, final boolean checkOverrideFile)
  3. createFileChooser(File presetFile, final String... postfixes)
  4. createFileChooser(String initDir)
  5. createFileChooser(String title, File dir, String filter)
  6. createJFileChooserWithExistenceChecking()
  7. createJFileChooserWithOverwritePrompting()
  8. createOpenFileChooser(String title, String dir, Component parent, FileFilter filter)
  9. createReportFileChooser(String curDir, File defaultReportFile)