From 4c85ef1b5d99025378b92acf587a0f62e3a83775 Mon Sep 17 00:00:00 2001 From: Marcoral Date: Fri, 3 May 2019 04:39:02 +0200 Subject: [PATCH 1/2] Bug fix --- .../borderless/BorderlessPane.java | 18 +--- .../borderless/BorderlessScene.java | 4 +- src/main/resources/fxml/Borderless.fxml | 89 +++++++++---------- .../resources/fxml/TransparentWindow.fxml | 2 +- 4 files changed, 47 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessPane.java b/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessPane.java index c61f18c..f42966a 100644 --- a/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessPane.java +++ b/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessPane.java @@ -5,7 +5,6 @@ import java.io.IOException; -import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.layout.AnchorPane; @@ -26,26 +25,13 @@ * @version 1.0 */ public class BorderlessPane extends AnchorPane { - - - - public BorderlessPane () throws IOException { + public BorderlessPane (BorderlessController controller) throws IOException { // ------------------------------------FXMLLOADER ---------------------------------------- FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Borderless.fxml")); - loader.setController(this); + loader.setController(controller); loader.setRoot(this); loader.load(); - - } - - - /** - * Called as soon as .fxml is initialised - */ - @FXML - private void initialize() { - } } diff --git a/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java b/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java index e320906..ea94b2c 100644 --- a/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java +++ b/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java @@ -51,15 +51,15 @@ public class BorderlessScene extends Scene { public BorderlessScene(Stage stage, StageStyle stageStyle, Parent sceneRoot) { super(new Pane()); try { + this.controller = new BorderlessController(); // Load the FXML - this.root = new BorderlessPane(); + this.root = new BorderlessPane(this.controller); // Set Scene root setRoot(this.root); setContent(sceneRoot); // Initialize the Controller - this.controller = new BorderlessController(); this.controller.setStage(stage); this.controller.createTransparentWindow(stage); diff --git a/src/main/resources/fxml/Borderless.fxml b/src/main/resources/fxml/Borderless.fxml index ae5a7ac..34d1e7f 100644 --- a/src/main/resources/fxml/Borderless.fxml +++ b/src/main/resources/fxml/Borderless.fxml @@ -5,53 +5,48 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/TransparentWindow.fxml b/src/main/resources/fxml/TransparentWindow.fxml index 281d431..37dcf62 100644 --- a/src/main/resources/fxml/TransparentWindow.fxml +++ b/src/main/resources/fxml/TransparentWindow.fxml @@ -3,6 +3,6 @@ - + From e95e36aa2b4c5f17eac9636e7f3ea697e5f7cfe8 Mon Sep 17 00:00:00 2001 From: Marcoral Date: Fri, 3 May 2019 06:16:11 +0200 Subject: [PATCH 2/2] Fix bug with removeDefaultCSS() --- .../fxborderlessscene/borderless/BorderlessScene.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java b/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java index ea94b2c..696b3ee 100644 --- a/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java +++ b/src/main/java/com/goxr3plus/fxborderlessscene/borderless/BorderlessScene.java @@ -233,9 +233,7 @@ public Delta getWindowedPositon() { * Removes the default css style of the corners */ public void removeDefaultCSS() { - - ((Parent) this.root.getChildren().get(0)).getStylesheets().remove(0); - + this.root.getStylesheets().remove(0); } /**