diff --git a/src/main/java/forge/gui/match/controllers/CDock.java b/src/main/java/forge/gui/match/controllers/CDock.java index 502fdb1e07e..8a282ae130a 100644 --- a/src/main/java/forge/gui/match/controllers/CDock.java +++ b/src/main/java/forge/gui/match/controllers/CDock.java @@ -93,10 +93,16 @@ public enum CDock implements ICDoc { @Override public Void doInBackground() { SaveOpenDialog dlgOpen = new SaveOpenDialog(); - File LoadFile = new File(SIOUtil.FILE_PREFERRED); - LoadFile = dlgOpen.OpenDialog(LoadFile, null); + File DefFile = new File(SIOUtil.FILE_PREFERRED); + File LoadFile = dlgOpen.OpenDialog(DefFile, Filetypes.LAYOUT); - SIOUtil.loadLayout(LoadFile); + if (LoadFile!=null) { + SIOUtil.loadLayout(LoadFile); + } + else { + SIOUtil.loadLayout(DefFile); + } + SIOUtil.saveLayout(); SOverlayUtils.hideOverlay(); return null; } diff --git a/src/main/java/forge/gui/toolbox/SaveOpenDialog.java b/src/main/java/forge/gui/toolbox/SaveOpenDialog.java index 3d39e696f7b..08d8569c965 100644 --- a/src/main/java/forge/gui/toolbox/SaveOpenDialog.java +++ b/src/main/java/forge/gui/toolbox/SaveOpenDialog.java @@ -53,13 +53,18 @@ public class SaveOpenDialog extends JPanel { } } + /** + * + * constructor for a save or open dialog + */ public SaveOpenDialog() { fc = new JFileChooser(); } + /** - * Shows the open dialog for files. If no file selected, returns default. Pass null - * to Type and Extension to allow all files to be viewed/opened. + * Shows the open dialog for files. If no file selected, returns null. Pass null + * to Type to allow all files to be viewed/opened. * @param defFileName pass the default file to use, also determines directory * @param type label to tell what type of file to filter * @@ -79,8 +84,9 @@ public class SaveOpenDialog extends JPanel { int RetValue = fc.showOpenDialog(getParent()); if (RetValue == JFileChooser.APPROVE_OPTION) { RetFile = fc.getSelectedFile(); + return RetFile; } - return RetFile; + return null; } /**