List of usage examples for javax.swing JFileChooser JFileChooser
public JFileChooser(FileSystemView fsv)
JFileChooser
using the given FileSystemView
. 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("."); boolean f = fileChooser.getDragEnabled(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();// w w w . java 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("."); ActionListener[] lis = fileChooser.getActionListeners(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/*from w ww . j a 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("."); FileView fileView = fileChooser.getFileView(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/* w w w .j ava 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("."); FileFilter f = fileChooser.getFileFilter(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/* w w w.ja v a 2s . 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("."); FileFilter[] filters = fileChooser.getChoosableFileFilters(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();// w w w . ja 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("."); boolean b = fileChooser.getControlButtonsAreShown(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/*from w w w . ja va 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("."); Icon icon = fileChooser.getIcon(new File(".")); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/* w w w. j a va 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("."); String name = fileChooser.getName(new File(".")); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/*ww w . ja v a 2 s. c o m*/ frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] a) { JFileChooser fileChooser = new JFileChooser("."); FileView view = new JavaFileView(); fileChooser.setFileView(view);/*from w w w . j a v a 2 s.c o m*/ 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 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.setControlButtonsAreShown(false); frame.add(fileChooser, BorderLayout.CENTER); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { JFileChooser theFileChooser = (JFileChooser) actionEvent.getSource(); String command = actionEvent.getActionCommand(); if (command.equals(JFileChooser.APPROVE_SELECTION)) { File selectedFile = theFileChooser.getSelectedFile(); System.out.println(selectedFile.getParent()); System.out.println(selectedFile.getName()); } else if (command.equals(JFileChooser.CANCEL_SELECTION)) { System.out.println(JFileChooser.CANCEL_SELECTION); }/* w ww. j av a2 s. c o m*/ } }; fileChooser.addActionListener(actionListener); fileChooser.removeActionListener(actionListener); frame.pack(); frame.setVisible(true); }