Minimize jfx window

Asked

Viewed 420 times

0

My window is without the edges of the system.

primaryStage.initStyle(StageStyle.UNDECORATED);

I created a button to minimize the window but I find Exception by assigning to my stage:

@FXML
void btnMinimizarOnAction(ActionEvent event) throws IOException
{
    Stage stage = (Stage) btnMinimizar.getScene().getWindow();
    stage.setIconified(true);
}

Is there any other way to do it?

1 answer

1


There may be different ways to get the Stage, but the method setIconified(true) should be called.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.