mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2024-12-21 07:00:22 +08:00
will not take operations when cancel the file chooser
This commit is contained in:
parent
926e276167
commit
0fc7eb6316
@ -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();
|
||||
|
@ -147,7 +147,6 @@
|
||||
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblRestart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblModpack" min="-2" max="-2" attributes="0"/>
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user