Java examples for JavaFX:Stage
center JavaFX Stage
//package com.java2s; import javafx.geometry.Rectangle2D; import javafx.stage.Screen; import javafx.stage.Stage; public class Main { public static void centerStage(Stage stage) { Rectangle2D primScreenBounds = Screen.getPrimary() .getVisualBounds();/*from w ww.java2s . c o m*/ stage.setX((primScreenBounds.getWidth() - stage.getWidth()) / 2); stage.setY((primScreenBounds.getHeight() - stage.getHeight()) / 2); } }