How to close a secondary stage, which is utilized as an auxiliary window? So I have a primaryStage used as the UI platform and occasionally I need to open a secondary window which is pretty straight forward, but to close it in a method is not clear.
Here's how secondary stage is engaged:
val ivbox = new VBox(children = new Label("Create New Album"))
val stackpane = new StackPane()
sp.children = Seq(ivbox)
val secondstage = new Stage() {
title = "second stage"
scene = new Scene(stackpane, 450, 150) {
stylesheets += getClass.getResource("uistyle.css").toExternalForm
}
x = myproto.stage.x.value + 200 // position in relation to primaryStage / scene
y = myproto.stage.y.value + 100 //
}
In JavaFX I found this clip:
private void closeButtonAction(){
Stage stage = (Stage) closeButton.getScene().getWindow();
stage.close();
}
Not clear how to come by in ScalaFx?