From: rnayabed Date: Thu, 24 Dec 2020 20:53:00 +0530 Subject: asdasdsdf --- asdasdsdf --- --- 'a/src/main/java/com/StreamPi/Util/Alert/StreamPiAlert.java' +++ b/src/main/java/com/StreamPi/Util/Alert/StreamPiAlert.java @@ -2,6 +2,7 @@ package com.StreamPi.Util.Alert; import com.StreamPi.Util.FormHelper.SpaceFiller; import com.StreamPi.Util.FormHelper.SpaceFiller.FillerType; +import com.StreamPi.Util.Platform.Platform; import org.kordamp.ikonli.javafx.FontIcon; @@ -26,7 +27,7 @@ public class StreamPiAlert { private StreamPiAlertType streamPiAlertType; private Pane contentPane; - private static StackPane stackPaneParent; + private static StackPane stackPaneParent = null; public static void setParent(StackPane parent) { stackPaneParent = parent; @@ -67,24 +68,19 @@ public class StreamPiAlert { this.streamPiAlertType = streamPiAlertType; } - public StreamPiAlert(String title, String contentText, String... buttons) + public StreamPiAlert(String title, String contentText) { Label label = new Label(contentText); label.setWrapText(true); VBox vBox = new VBox(label); - set(title, StreamPiAlertType.INFORMATION, vBox, buttons); + set(title, StreamPiAlertType.INFORMATION, vBox, new String[]{ "OK" }); } - public StreamPiAlert(String title, String contentText) + public StreamPiAlert(String title, StreamPiAlertType streamPiAlertType, String... buttons) { - Label label = new Label(contentText); - label.setWrapText(true); - - VBox vBox = new VBox(label); - - set(title, StreamPiAlertType.INFORMATION, vBox, new String[]{ "OK" }); + set(title, streamPiAlertType, null, new String[]{ "OK" }); } @@ -133,6 +129,9 @@ public class StreamPiAlert { VBox alertVBox = new VBox(); alertVBox.getStyleClass().add("alert_pane"); + if(title.isEmpty()) + title = "Alert"; + Label label = new Label(title); label.getStyleClass().add("alert_pane_header_text"); @@ -192,12 +191,16 @@ public class StreamPiAlert { private Node popupNode; public void show() { - popupNode = getAlertPane(getTitle(), getContentPane()); - stackPaneParent.getChildren().add(popupNode); + javafx.application.Platform.runLater(()->{ + popupNode = getAlertPane(getTitle(), getContentPane()); + stackPaneParent.getChildren().add(popupNode); + }); } public void destroy() { - stackPaneParent.getChildren().remove(popupNode); + javafx.application.Platform.runLater(()->{ + stackPaneParent.getChildren().remove(popupNode); + }); } } --- 'a/src/main/java/com/StreamPi/Util/ComboBox/StreamPiComboBox.java' +++ b/src/main/java/com/StreamPi/Util/ComboBox/StreamPiComboBox.java @@ -8,6 +8,7 @@ import com.StreamPi.Util.FormHelper.Spac import org.kordamp.ikonli.javafx.FontIcon; +import javafx.application.Platform; import javafx.collections.ListChangeListener; import javafx.scene.Node; import javafx.scene.control.Label; @@ -166,13 +167,17 @@ public class StreamPiComboBox extends private Node popupNode; public void show() { - popupNode = getPopupScrollPane(); - stackPaneParent.getChildren().add(popupNode); + Platform.runLater(()->{ + popupNode = getPopupScrollPane(); + stackPaneParent.getChildren().add(popupNode); + }); } public void destroy() { - stackPaneParent.getChildren().remove(popupNode); + Platform.runLater(()->{ + stackPaneParent.getChildren().remove(popupNode); + }); } private StreamPiComboBoxFactory streamPiComboBoxFactory;