diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameSettingsPanel.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameSettingsPanel.java index d139e4a72..3cb0b9294 100755 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameSettingsPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameSettingsPanel.java @@ -1127,8 +1127,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi fc.setFileSelectionMode(JSystemFileChooser.DIRECTORIES_ONLY); fc.setDialogTitle(C.i18n("settings.choose_gamedir")); fc.setMultiSelectionEnabled(false); - fc.showOpenDialog(this); - if (fc.getSelectedFile() == null) + if (fc.showOpenDialog(this) != JSystemFileChooser.APPROVE_OPTION || fc.getSelectedFile() == null) return; try { String path = fc.getSelectedFile().getCanonicalPath(); @@ -1163,8 +1162,7 @@ public final class GameSettingsPanel extends RepaintPage implements DropTargetLi fc.setFileFilter(new FileNameFilter("javaw.exe")); fc.addChoosableFileFilter(new FileNameFilter("java.exe")); fc.addChoosableFileFilter(new FileNameFilter("java")); - fc.showOpenDialog(this); - if (fc.getSelectedFile() == null) + if (fc.showOpenDialog(this) != JSystemFileChooser.APPROVE_OPTION || fc.getSelectedFile() == null) return; try { String path = fc.getSelectedFile().getCanonicalPath(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.form b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.form index 3bec9d2fc..a48c14e64 100755 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.form +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.form @@ -147,7 +147,6 @@ - diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.java index cad2a5c9a..ddaa1e9c3 100755 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LauncherSettingsPanel.java @@ -408,8 +408,7 @@ public class LauncherSettingsPanel extends RepaintPage { fc.setMultiSelectionEnabled(false); fc.setFileFilter(new FileNameExtensionFilter("*.png", "png")); fc.addChoosableFileFilter(new FileNameExtensionFilter("*.jpg", "jpg")); - fc.showOpenDialog(this); - if (fc.getSelectedFile() == null) + if (fc.showOpenDialog(this) != JSystemFileChooser.APPROVE_OPTION || fc.getSelectedFile() == null) return; try { String path = fc.getSelectedFile().getCanonicalPath(); @@ -486,8 +485,7 @@ public class LauncherSettingsPanel extends RepaintPage { fc.setFileSelectionMode(JSystemFileChooser.DIRECTORIES_ONLY); fc.setDialogTitle(C.i18n("launcher.choose_commonpath")); fc.setMultiSelectionEnabled(false); - fc.showOpenDialog(this); - if (fc.getSelectedFile() == null) + if (fc.showOpenDialog(this) != JSystemFileChooser.APPROVE_OPTION || fc.getSelectedFile() == null) return; try { String path = fc.getSelectedFile().getCanonicalPath(); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ui/JSystemFileChooser.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ui/JSystemFileChooser.java index 88d25f241..53e908306 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ui/JSystemFileChooser.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ui/JSystemFileChooser.java @@ -33,7 +33,7 @@ public class JSystemFileChooser extends JFileChooser { public JSystemFileChooser() { super(); } - + public JSystemFileChooser(File f) { super(f); } @@ -49,15 +49,10 @@ public class JSystemFileChooser extends JFileChooser { super.updateUI(); - if (old != null) { - Color background = UIManager.getColor("Label.background"); - setBackground(background); - setOpaque(true); - + if (old != null) try { UIManager.setLookAndFeel(old); } catch (UnsupportedLookAndFeelException ignored) { } - } } }