1 | void clearFileFilters() {↵ | | 1 | void clearFileFilters() {↵
|
2 | FileFilter[] filters = jfc.getChoosableFileFilters();↵ | | 2 | FileFilter[] filters = jfc.getChoosableFileFilters();↵
|
3 | for (int x = 0; x < filters.length; x++) {↵ | | 3 | for (int x = 0; x < filters.length; x++) {↵
|
4 | jfc.removeChoosableFileFilter(filters[x]);↵ | | 4 | jfc.removeChoosableFileFilter(filters[x]);↵
|
5 | }↵ | | 5 | }↵
|
6 | }↵ | | 6 | }↵
|
|
7 | public static JFileChooser promptToOpenFile() {↵ | | 7 | public static JFileChooser promptToOpenFile() {↵
|
8 | return promptToOpenFile(new String[0]);↵ | | 8 | return promptToOpenFile(new String[0]);↵
|
9 | }↵ | | 9 | }↵
|
|
10 | /**↵ | | 10 | /**↵
|
11 | * Prompts the user to choose a file from their filesystems for our own↵ | | 11 | * Prompts the user to choose a file from their filesystems for our own↵
|
12 | * devious uses. This method maintains the last directory the user visited↵ | | 12 | * devious uses. This method maintains the last directory the user visited↵
|
13 | * before dismissing the dialog. This does NOT imply they actually chose a↵ | | 13 | * before dismissing the dialog. This does NOT imply they actually chose a↵
|
14 | * file from that directory, only that they closed the dialog there. It is↵ | | 14 | * file from that directory, only that they closed the dialog there. It is↵
|
15 | * the caller's responsibility to check to see if the selected file is↵ | | 15 | * the caller's responsibility to check to see if the selected file is↵
|
16 | * non-null.↵ | | 16 | * non-null.↵
|
17 | * ↵ | | 17 | * ↵
|
18 | * @return the JFileChooser that interacted with the user, after they are↵ | | 18 | * @return the JFileChooser that interacted with the user, after they are↵
|
19 | * finished using it (accept or otherwise).↵ | | 19 | * finished using it - null if no file was chosen↵
|
20 | * @see #promptToOpenFile()↵ | | 20 | * @see #promptToOpenFile()↵
|
21 | */↵ | | 21 | */↵
|
22 | public static JFileChooser promptToSaveFile(String filename) {↵ | | 22 | public static JFileChooser promptToSaveFile(String filename) {↵
|
23 | return promptToSaveFile(filename, null);↵ | | 23 | return promptToSaveFile(filename, null);↵
|
24 | } | | 24 | }
|