List of utility methods to do JFileChooser
File | getFile(FileFilter filter) get File JFileChooser chooser = new JFileChooser(System.getProperty("user.dir")); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile(); return null; |
String | getFile(String initialPath, final String extension, String TitleText) get File final String ext = extension.replace("*", ""); JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(initialPath)); chooser.setDialogTitle(TitleText); FileFilter filter = new FileFilter() { @Override public String getDescription() { return extension; ... |
File[] | getFile(String message, boolean isLoadNotSave, File defaultFileOrDir, boolean allowMultipleSelection, String description, final String... extensions) get File if (isMac()) { java.awt.Frame frame = new java.awt.Frame(); java.awt.FileDialog chooser = new java.awt.FileDialog(frame, message, (isLoadNotSave ? java.awt.FileDialog.LOAD : java.awt.FileDialog.SAVE)); if (defaultFileOrDir != null) { if (defaultFileOrDir.isDirectory()) { chooser.setDirectory(defaultFileOrDir.getAbsolutePath()); } else { ... |
File | getFile(String title, File initialDir) get File JFileChooser fChooser = new JFileChooser(initialDir); fChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fChooser.setDialogTitle(title); if (fChooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) return (null); File c = fChooser.getSelectedFile(); return (c); |
JFileChooser | getFileChooser() get File Chooser return fileChooser;
|
JFileChooser | getFileChooser() get File Chooser for (Window w : Window.getWindows()) if (w instanceof JDialog && w.isShowing()) if (((JDialog) w).getContentPane().getComponent(0) instanceof JFileChooser) return (JFileChooser) ((JDialog) w).getContentPane().getComponent(0); throw new IllegalStateException("no file chooser found!"); |
JFileChooser | getFileChooser() get File Chooser if (chooser == null) { chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.addChoosableFileFilter(new FileFilter() { @Override public String getDescription() { return "Otros LogView investigation *.zip.olv"; ... |
JFileChooser | getFileChooser() Gets the file chooser. return chooser;
|
JFileChooser | getFileChooser() Returns a JFileChooser with the filter 'All Files' if (fileChooser == null) { fileChooser = new JFileChooser(); fileChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Alle Dateien"; @Override ... |
JFileChooser | getFileChooser() get File Chooser fc.resetChoosableFileFilters();
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
return fc;
|