From 8ca59685edd16c0aac409bc42303d4c62b339116 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 23 Oct 2023 16:27:19 +0200 Subject: [PATCH] Fix duplicate preference window upon prefs import --- .../dialogs/preferences/GeneralPreferencesPanel.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java index 98e993c6f..2090a9b66 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java @@ -364,7 +364,16 @@ public class GeneralPreferencesPanel extends PreferencesPanel { trans.get("generalprefs.ImportWarning.msg"), trans.get("generalprefs.ImportWarning.title"), JOptionPane.WARNING_MESSAGE); - PreferencesDialog.showPreferences(parent.getParentFrame()); // Refresh the preferences dialog + + // Introduce a small delay before showing the PreferencesDialog + Timer timer = new Timer(100, new ActionListener() { // 100ms delay + @Override + public void actionPerformed(ActionEvent arg0) { + PreferencesDialog.showPreferences(parent.getParentFrame()); // Refresh the preferences dialog + } + }); + timer.setRepeats(false); // Only execute once + timer.start(); // Start the timer } }); }