From 4309377599add05f326cd6269c2dba11bf661317 Mon Sep 17 00:00:00 2001 From: octo-kumo Date: Sat, 15 Aug 2020 15:22:05 +0800 Subject: [PATCH] Tried alot of thing but decided to just hack my way through --- build.gradle | 5 ++-- .../controllers/PreferenceController.java | 29 ++++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index b81d512..7e1bbcc 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { } group 'app.nush' -version '1.3.9-beta' +version '1.3.A-beta' applicationName = 'Exam Clock' mainClassName = 'app.nush.examclock.Main' @@ -20,7 +20,7 @@ repositories { // } } -double jdkVersion = 1.8 +double jdkVersion = 1.14 println "JDK version = ${jdkVersion}" sourceCompatibility = 1.8 @@ -78,6 +78,5 @@ jar { 'Specification-Title': "Exam Clock", 'Specification-Version': "$version", 'Specification-Vendor': "Appventure@NUSHIGH") - } } \ No newline at end of file diff --git a/src/main/java/app/nush/examclock/controllers/PreferenceController.java b/src/main/java/app/nush/examclock/controllers/PreferenceController.java index d0ddffb..315ee8c 100644 --- a/src/main/java/app/nush/examclock/controllers/PreferenceController.java +++ b/src/main/java/app/nush/examclock/controllers/PreferenceController.java @@ -7,8 +7,12 @@ import com.dlsc.preferencesfx.model.Category; import com.dlsc.preferencesfx.model.Group; import com.dlsc.preferencesfx.model.Setting; +import com.dlsc.preferencesfx.view.PreferencesFxView; import javafx.beans.property.*; +import javafx.scene.Scene; +import javafx.scene.control.DialogPane; import javafx.scene.paint.Color; +import javafx.stage.Modality; import javafx.stage.Stage; /** @@ -65,6 +69,8 @@ public class PreferenceController { public static String clockID; private final MainController controller; private PreferencesFx preferencesFx; + private PreferencesFxView view; + private Stage stage; /** * Instantiates a new Preference controller. @@ -127,14 +133,15 @@ public void initPreferences() { Setting.of("Open to requests", openToRequestsProperty) ) ) - ); - preferencesFx.getView().getScene().getStylesheets().addAll("/theme.css", nightMode.get() ? "/theme.dark.css" : "/theme.light.css"); - preferencesFx.getView().getStyleClass().add("preference"); - Stage window = (Stage) preferencesFx.getView().getScene().getWindow(); - window.setMaxHeight(500); - window.setWidth(600); - window.setHeight(500); - preferencesFx.persistWindowState(true); + ).persistWindowState(true); + view = preferencesFx.getView(); + view.getStyleClass().add("preference"); + ((DialogPane) view.getParent()).getChildren().remove(view); + stage = new Stage(); + stage.initModality(Modality.APPLICATION_MODAL); + Scene scene = new Scene(view, 700, 400); + scene.getStylesheets().addAll("/theme.css", nightMode.get() ? "/theme.dark.css" : "/theme.light.css"); + stage.setScene(scene); } /** @@ -144,8 +151,8 @@ public void attachListeners() { nightMode.addListener((observable, oldValue, newValue) -> { ExamClock.getStage().getScene().getStylesheets().removeAll("/theme.dark.css", "/theme.light.css"); ExamClock.getStage().getScene().getStylesheets().add(newValue ? "/theme.dark.css" : "/theme.light.css"); - preferencesFx.getView().getScene().getStylesheets().removeAll("/theme.dark.css", "/theme.light.css"); - preferencesFx.getView().getScene().getStylesheets().addAll("/theme.css", nightMode.get() ? "/theme.dark.css" : "/theme.light.css"); + view.getScene().getStylesheets().removeAll("/theme.dark.css", "/theme.light.css"); + view.getScene().getStylesheets().addAll("/theme.css", nightMode.get() ? "/theme.dark.css" : "/theme.light.css"); }); } @@ -155,7 +162,7 @@ public void attachListeners() { * @param modal the modal */ public void show(boolean modal) { - preferencesFx.show(modal); + stage.show(); } }