UI corrections

Save window size on close & restore on start.
This commit is contained in:
Dmitry Isaenko 2019-10-21 01:38:02 +03:00
parent 10d7cce148
commit 26bd85d744
3 changed files with 22 additions and 2 deletions

View file

@ -119,4 +119,10 @@ public class AppPreferences {
public String getUseOldGlVersion(){ return preferences.get("OldGlVersion", ""); }
public void setUseOldGlVersion(String version){ preferences.put("OldGlVersion", version);}
public double getSceneWidth(){ return preferences.getDouble("WIND_WIDTH", 850.0); }
public void setSceneWidth(double value){ preferences.putDouble("WIND_WIDTH", value); }
public double getSceneHeight(){ return preferences.getDouble("WIND_HEIGHT", 475.0); }
public void setSceneHeight(double value){ preferences.putDouble("WIND_HEIGHT", value); }
}

View file

@ -33,7 +33,10 @@ public class NSLMain extends Application {
primaryStage.setTitle("NS-USBloader "+appVersion);
primaryStage.setMinWidth(650);
primaryStage.setMinHeight(450);
Scene mainScene = new Scene(root, 850, 475);
Scene mainScene = new Scene(root,
AppPreferences.getInstance().getSceneWidth(),
AppPreferences.getInstance().getSceneHeight()
);
mainScene.getStylesheets().add(AppPreferences.getInstance().getTheme());
@ -48,7 +51,11 @@ public class NSLMain extends Application {
NSLMainController controller = loader.getController();
controller.setHostServices(getHostServices());
primaryStage.setOnHidden(e-> controller.exit());
primaryStage.setOnHidden(e-> {
AppPreferences.getInstance().setSceneHeight(mainScene.getHeight());
AppPreferences.getInstance().setSceneWidth(mainScene.getWidth());
controller.exit();
});
}
public static void main(String[] args) {

View file

@ -7,6 +7,7 @@
.button, .buttonUp, .buttonStop, .buttonSelect{
-fx-background-color: #fefefe;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #fefefe;
-fx-border-radius: 3;
-fx-border-width: 2;
@ -15,6 +16,7 @@
}
.button:hover, .buttonStop:hover, .buttonUp:hover, .choice-box:hover, .button:focused:hover, .buttonStop:focused:hover, .buttonUp:focused:hover, .buttonSelect:focused:hover, .choice-box:focused:hover{
-fx-background-color: #fefefe;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #00caca;
-fx-border-radius: 3;
-fx-border-width: 2;
@ -23,6 +25,7 @@
}
.button:focused, .buttonStop:focused, .buttonUp:focused, .buttonSelect:focused, .choice-box:focused{
-fx-background-color: #cccccc;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #cccccc;
-fx-border-radius: 3;
-fx-border-width: 2;
@ -32,6 +35,7 @@
.button:pressed, .button:pressed:hover{
-fx-background-color: #fefefe;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #e82382;
-fx-border-radius: 3;
-fx-border-width: 2;
@ -40,6 +44,7 @@
}
.buttonSelect:pressed, .buttonSelect:pressed:hover{
-fx-background-color: #fefefe;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #289de8;
-fx-border-radius: 3;
-fx-border-width: 2;
@ -48,6 +53,7 @@
}
.buttonUp:pressed, .buttonUp:pressed:hover{
-fx-background-color: #fefefe;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #71e016;
-fx-border-radius: 3;
-fx-border-width: 2;
@ -56,6 +62,7 @@
}
.buttonStop:pressed, .buttonStop:pressed:hover{
-fx-background-color: #fefefe;
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-border-color: #fb582c;
-fx-border-radius: 3;
-fx-border-width: 2;