Neeko
Neeko

Reputation: 1149

Cannot Maximize Window with JavaFX

I made a custom Minimize button this way:

public MinimizeButton() {
    Button button = new Button("-");
    button.getStyleClass().clear();
    button.getStyleClass().add("actionbutton");
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            Stage stage = (Stage) ((Button) event.getSource()).getScene().getWindow();
            stage.setIconified(true);
        }
    });
    this.getChildren().add(button);
}

And I obviously called

primaryStage.initStyle(StageStyle.UNDECORATED);

The button is working well.

The issue is that when I try to maximize the Window once the Stage is iconified, it takes a couple of seconds for the Window to redraw the Stage.

Any ideas on how to make the "Maximizing process" of the Window faster?

Upvotes: 1

Views: 834

Answers (1)

Neeko
Neeko

Reputation: 1149

Fixed it by using

primaryStage.initStyle(StageStyle.TRANSPARENT);

instead of

primaryStage.initStyle(StageStyle.UNDECORATED);

Upvotes: 2

Related Questions