How to set a JavaFX Stage/Frame to Maximized

Dorothy picture Dorothy · Jul 28, 2011 · Viewed 56.3k times · Source

I'm using JavaFX 2. I want my frame to open maximized but I'm not seeing a way. I searched a bit on the internet without success. For the stage I see setFullScreen() and setIconified() but I don't see anything like setMaximized().

Answer

Hans picture Hans · Dec 16, 2013

The Java 8 implementation of the Stage class provides a maximized property, which can be set as follows:

primaryStage.setMaximized(true);