Skip to content

Commit 229f408

Browse files
committed
Merge branch 'master' of github.com:processing/processing
2 parents 5827503 + 2368391 commit 229f408

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

app/src/processing/app/Base.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public class Base {
127127
private JMenu sketchbookMenu;
128128

129129
private Recent recent;
130+
131+
private JFileChooser fileChooser; // to remember the current directory
130132
// private JMenu recentMenu;
131133

132134
static protected File sketchbookFolder;
@@ -862,10 +864,13 @@ public boolean accept(File dir, String name) {
862864
}
863865

864866
} else {
865-
JFileChooser fc = new JFileChooser();
866-
fc.setDialogTitle(prompt);
867+
if (fileChooser == null)
868+
{
869+
fileChooser = new JFileChooser();
870+
}
871+
fileChooser.setDialogTitle(prompt);
867872

868-
fc.setFileFilter(new javax.swing.filechooser.FileFilter() {
873+
fileChooser.setFileFilter(new javax.swing.filechooser.FileFilter() {
869874
public boolean accept(File file) {
870875
// JFileChooser requires you to explicitly say yes to directories
871876
// as well (unlike the AWT chooser). Useful, but... different.
@@ -885,8 +890,8 @@ public String getDescription() {
885890
return "Processing Sketch";
886891
}
887892
});
888-
if (fc.showOpenDialog(activeEditor) == JFileChooser.APPROVE_OPTION) {
889-
handleOpen(fc.getSelectedFile().getAbsolutePath());
893+
if (fileChooser.showOpenDialog(activeEditor) == JFileChooser.APPROVE_OPTION) {
894+
handleOpen(fileChooser.getSelectedFile().getAbsolutePath());
890895
}
891896
}
892897
}

0 commit comments

Comments
 (0)