Polished settings mechanism

* Set initial value of onCloseMode setting to true
* Added setting change handlers
* Applying settings changes immediately
* Made PrimaryToggleSwitch round
This commit is contained in:
2019-12-23 16:33:13 +01:00
parent 4ef0b3352c
commit 07b2c73b50
8 changed files with 39 additions and 78 deletions

View File

@ -143,8 +143,7 @@ public class Startup {
new StatusTrayIcon(chatWindow).show();
// If the tray icon is supported and corresponding settings is set, hide the chat window on close
if (Settings.getInstance().getCurrentOnCloseMode())
chatWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
Settings.getInstance().getItems().get("onCloseMode").setChangeHandler((onCloseMode) -> chatWindow.setDefaultCloseOperation((boolean) onCloseMode ? JFrame.HIDE_ON_CLOSE : JFrame.EXIT_ON_CLOSE));
} catch (EnvoyException e) {
logger.warning("The StatusTrayIcon is not supported on this platform!");
}