Example usage for javax.swing JFileChooser JFileChooser

List of usage examples for javax.swing JFileChooser JFileChooser

Introduction

In this page you can find the example usage for javax.swing JFileChooser JFileChooser.

Prototype

public JFileChooser(FileSystemView fsv) 

Source Link

Document

Constructs a JFileChooser using the given FileSystemView.

Usage

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    fileChooser.setAcceptAllFileFilterUsed(false);

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*from   w w  w.j a v a  2 s.c  om*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");

    int mode = fileChooser.getFileSelectionMode();
    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*from  w w w.ja  v a 2  s .  c  o  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");

    String text = fileChooser.getApproveButtonToolTipText();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*w w w .  j  a  v  a2  s.c  o  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");

    String text = fileChooser.getApproveButtonText();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();// w w w .j  a va2s .  com
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");

    int mu = fileChooser.getApproveButtonMnemonic();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();// w w w .  j  a va 2 s. co m
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] a) {
    JFileChooser fileChooser = new JFileChooser(".");
    fileChooser.setAccessory(new LabelAccessory(fileChooser));
    int status = fileChooser.showOpenDialog(null);
    if (status == JFileChooser.APPROVE_OPTION) {
        File selectedFile = fileChooser.getSelectedFile();
        System.out.println(selectedFile.getParent());
        System.out.println(selectedFile.getName());
    } else if (status == JFileChooser.CANCEL_OPTION) {
        System.out.println("JFileChooser.CANCEL_OPTION");
    }//from w w  w . j a v a2  s.  c  o  m
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    fileChooser.ensureFileIsVisible(new File("."));

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*from  w ww.  j a  v a 2s.c  o  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    String f = fileChooser.getDescription(new File("."));

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*  w ww .  j  a  va2s  .c o  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    String f = fileChooser.getDialogTitle();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();/*from  w  w w .  j  a v a 2  s.co m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("JFileChooser Popup");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JFileChooser fileChooser = new JFileChooser(".");
    int type = fileChooser.getDialogType();

    frame.add(fileChooser, BorderLayout.CENTER);

    frame.pack();//  w ww. ja  va2 s  .  com
    frame.setVisible(true);
}