Examples of JFolderChooser


Examples of org.psafix.folderchooser.JFolderChooser

   * @return the selected path. Returns null if the user did not activate the approve option (closed the window or
   * clicked "Cancel")
   */
  public static String chooseFolder(String startingPath, Component parent, String title, Dimension dimension) {
    try {
      JFolderChooser chooser = new JFolderChooser();
      chooser.setPreferredSize(dimension);
      File outputFile = new File(startingPath);
      if (outputFile.exists()) {
        chooser.setCurrentDirectory(outputFile);
      }
      chooser.setTitle(title);
      int choice = chooser.showOpenDialog(parent);
      if (choice == JFolderChooser.APPROVE_OPTION) {
        return chooser.getSelectedFile().getPath();
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "There has been an error:" + StringHelper.newline + e);
    }
    return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.