Class SettingsWindowCommon
java.lang.Object
com.everdro1d.libs.swing.windows.settings.SettingsWindowCommon
The
SettingsWindowCommon class provides utility methods for importing and exporting user settings,
managing file paths for settings, and interacting with file choosers.
This class is non-instantiable and contains only static methods.
Features:
- Import settings from an XML file and apply them using
Preferences. - Export current settings to an XML file using
Preferences. - Retrieve or set file paths for settings using a custom file chooser.
Example Usage:
String filePath = SettingsWindowCommon.getFilePathUser(true, true, frame, localeManager, prefs); SettingsWindowCommon.exportSettings(filePath, true, frame, prefs);
Note: This class cannot be instantiated.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidexportSettings(String filePath, boolean debug, JFrame settingsFrame, Preferences prefs) Exports current settings to an XML file usingPreferences.static StringgetFilePathUser(boolean export, boolean debug, JFrame settingsFrame, LocaleManager localeManager, Preferences prefs) Retrieves the file path for importing or exporting settings using a file chooser.static voidimportSettings(String filePath, boolean debug, JFrame settingsFrame) Imports settings from an XML file and applies them usingPreferences.
-
Method Details
-
importSettings
Imports settings from an XML file and applies them usingPreferences.- Parameters:
filePath- the path to the XML file containing the settingsdebug- whether to enable debug loggingsettingsFrame- the parent frame for displaying messages
-
exportSettings
public static void exportSettings(String filePath, boolean debug, JFrame settingsFrame, Preferences prefs) Exports current settings to an XML file usingPreferences.- Parameters:
filePath- the path to save the XML filedebug- whether to enable debug loggingsettingsFrame- the parent frame for displaying messagesprefs- thePreferencesnode to export
-
getFilePathUser
public static String getFilePathUser(boolean export, boolean debug, JFrame settingsFrame, LocaleManager localeManager, Preferences prefs) Retrieves the file path for importing or exporting settings using a file chooser.- Parameters:
export- whether the operation is an exportdebug- whether to enable debug loggingsettingsFrame- the parent frame for the file chooserlocaleManager- theLocaleManagerfor localizationprefs- thePreferencesnode to store the file path- Returns:
- the selected file path, or an empty string if canceled
-