how to keep items on screen on resize javafx code example Example: javafx window resize to screen primaryStage.setMaximized(true);