List of usage examples for javafx.scene Node getBoundsInLocal
public final Bounds getBoundsInLocal()
From source file:com.eviware.loadui.ui.fx.util.NodeUtils.java
public static Rectangle2D localToScreen(Node node, Scene scene) { Bounds selectableBounds = node.localToScene(node.getBoundsInLocal()); return new Rectangle2D(selectableBounds.getMinX() + scene.getX() + scene.getWindow().getX(), selectableBounds.getMinY() + scene.getY() + scene.getWindow().getY(), node.getBoundsInLocal().getWidth(), node.getBoundsInLocal().getHeight()); }
From source file:com.eviware.loadui.ui.fx.util.NodeUtils.java
public static Bounds absoluteBoundsOf(Node node) { double tX = node.getScene().getWindow().getX() + node.getScene().getX(); double tY = node.getScene().getWindow().getY() + node.getScene().getY(); Bounds boundsInScene = node.localToScene(node.getBoundsInLocal()); return new BoundingBox(boundsInScene.getMinX() + tX, boundsInScene.getMinY() + tY, boundsInScene.getWidth(), boundsInScene.getHeight());// w w w . j a v a 2s. c o m }
From source file:Main.java
public static void addMarker(final XYChart<?, ?> chart, final StackPane chartWrap) { final Line valueMarker = new Line(); final Node chartArea = chart.lookup(".chart-plot-background"); chartArea.setOnMouseMoved(new EventHandler<MouseEvent>() { @Override/*from www. j a v a 2 s .c om*/ public void handle(MouseEvent event) { Point2D scenePoint = chart.localToScene(event.getSceneX(), event.getSceneY()); Point2D position = chartWrap.sceneToLocal(scenePoint.getX(), scenePoint.getY()); Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal()); valueMarker.setStartY(0); valueMarker.setEndY(chartWrap.sceneToLocal(chartAreaBounds).getMaxY() - chartWrap.sceneToLocal(chartAreaBounds).getMinY()); valueMarker.setStartX(0); valueMarker.setEndX(0); valueMarker.setTranslateX(position.getX() - chartWrap.getWidth() / 2); double ydelta = chartArea.localToScene(0, 0).getY() - chartWrap.localToScene(0, 0).getY(); valueMarker.setTranslateY(-ydelta * 2); } }); chartWrap.getChildren().add(valueMarker); }