List of usage examples for javax.swing JFileChooser JFileChooser
public JFileChooser(FileSystemView fsv)
JFileChooser
using the given FileSystemView
. From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java
private void loadPositiveNegativeNT() throws IOException { JFileChooser chooser = new JFileChooser("Load multiple nt files. Please choose a directory"); chooser.setCurrentDirectory(frame.defaultDirectory); if (geoFile != null) { chooser.setCurrentDirectory(geoFile); }/*w w w . jav a 2s . c o m*/ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); int returnVal = chooser.showSaveDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { System.out.print("Loading..."); frame.loadPositiveNegativeNT(chooser.getSelectedFile()); System.out.println("loading finished."); } }
From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java
private void show_open_hamql_dialog() { FileFilter filter = createFilter(); JFileChooser jf = new JFileChooser("conf/query/"); jf.setFileFilter(filter);//from w w w.jav a 2 s .c o m jf.setDialogTitle("HamQL (SpinQL) ?J"); int returnVal = jf.showOpenDialog(this); if (returnVal != JFileChooser.APPROVE_OPTION) return; File f = jf.getSelectedFile(); try { FileReader reader = new FileReader(f); BufferedReader br = new BufferedReader(reader); StringBuilder buf = new StringBuilder(); String tmp = null; while ((tmp = br.readLine()) != null) { buf.append(tmp + "\n"); } br.close(); reader.close(); getJTextArea().setText(buf.toString()); } catch (Exception e) { e.printStackTrace(); } }