JavaFX resizing window

Viewed 214

I've got a problem with resizing window in javafx. I want maxHeight of stage to be at most three fourth of width of the stage. That code reproduces my issue

public class Main extends Application {

    @Override
    public void start(Stage stage) throws Exception{
        stage.show();
        stage.widthProperty().addListener((obs, oldVal, newVal) -> {
            stage.setMaxHeight(newVal.doubleValue() * 0.75);
            System.out.println(stage.getMaxHeight());
        });
    }

    public static void main(String[] args) { launch(args); }
}

Problem occurs when I try to stretch window (by clicking the CORNER and dragging to resize). Width is getting bigger but at the same time I can't stretch it vertically, until I release mouse button, although value of maxHeight is much bigger than it's showed on screen (e.g. value of maxHeight is 500 but I can resize it to e.g. only 300). It looks like something is blocked until I release mouse button. I'd like to be able to resize window (by dragging the corner) vertically and horizontally simultaneously, what is not possible. I tried a lot of things (with binding) but problem remains the same.

0 Answers
Related