How can I prevent maximizing a JavaFX window to fullscreen?


I have done this...


which works fine for removing the maximize button but someone can still double click on the window title bar (in Windows) to maximize the window.

I tried this but it does not fire.

myStage.fullScreenProperty().addListener(new ChangeListener<Boolean>() {
            public void changed(ObservableValue<? extends Boolean> prop, Boolean wasIconified, Boolean isIconified) {
                System.out.println("ignore fullscreen");

Is there some other way to consume that event so it has no effect?

8/17/2014 11:19:42 PM

Actually you are listening to the wrong property the one that you are looking for is maximizedProperty

Here is the code to disable window maximize :

primaryStage.maximizedProperty().addListener((observable, oldValue, newValue) -> {
            if (newValue)

it listens for maximize events then checks whether it's actually maximizing through if (newVale) then forces the stage disable maximization.

hope it helps

7/21/2016 11:16:10 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow