Java Code Examples for java.awt.FileDialog#setMultipleMode()
The following examples show how to use
java.awt.FileDialog#setMultipleMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainFrame.java From lizzie with GNU General Public License v3.0 | 5 votes |
public void openFile() { JSONObject filesystem = Lizzie.config.persisted.getJSONObject("filesystem"); FileDialog fileDialog = new FileDialog(this, resourceBundle.getString("LizzieFrame.openFile")); fileDialog.setLocationRelativeTo(this); fileDialog.setDirectory(filesystem.getString("last-folder")); fileDialog.setFile("*.sgf;*.gib;*.SGF;*.GIB"); fileDialog.setMultipleMode(false); fileDialog.setMode(0); fileDialog.setVisible(true); File[] file = fileDialog.getFiles(); if (file.length > 0) loadFile(file[0]); }
Example 2
Source File: FileDialogUtils.java From pumpernickel with MIT License | 5 votes |
/** * Returns files the user selected or an empty array if the user cancelled * the dialog. */ public static File[] showOpenDialog(Frame f, String title, boolean allowMultipleSelection, FilenameFilter filter) { FileDialog fd = new FileDialog(f, title); fd.setMode(FileDialog.LOAD); if (filter != null) fd.setFilenameFilter(filter); fd.pack(); fd.setMultipleMode(allowMultipleSelection); fd.setLocationRelativeTo(null); fd.setVisible(true); if (fd.getFile() == null) return new File[] {}; return fd.getFiles(); }