Java examples for JavaFX:Node
Get the absolute position of the top left corner of the passed in JavaFX control
//package com.java2s; import javafx.geometry.Point2D; import javafx.scene.Scene; import javafx.scene.control.Control; import javafx.stage.Window; public class Main { /**/*from ww w . j a va2s. com*/ * Get the absolute position of the top left corner of the passed in control * * @param control * @return */ public static Point2D screenPositionOf(Control control) { Point2D center = control.localToScene(0, 0); Scene s = control.getScene(); Window w = s.getWindow(); return new Point2D(center.getX() + w.getX(), center.getY() + w.getY()); } }