Example usage for javafx.geometry BoundingBox BoundingBox

List of usage examples for javafx.geometry BoundingBox BoundingBox

Introduction

In this page you can find the example usage for javafx.geometry BoundingBox BoundingBox.

Prototype

public BoundingBox(@NamedArg("minX") double minX, @NamedArg("minY") double minY,
        @NamedArg("width") double width, @NamedArg("height") double height) 

Source Link

Document

Creates a new instance of 2D BoundingBox .

Usage

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());//from w  ww  . ja  v  a 2  s . c om
}

From source file:org.eclipse.jubula.rc.javafx.driver.RobotJavaFXImpl.java

/**
 *
 * {@inheritDoc}//  w ww  . j  av  a 2s.c  om
 */
public boolean isMouseInComponent(final Object graphicsComponent) {
    final Point currMousePos = getCurrentMousePosition();
    return EventThreadQueuerJavaFXImpl.invokeAndWait("isMouseInComponent", //$NON-NLS-1$
            new Callable<Boolean>() {

                @Override
                public Boolean call() throws Exception {
                    if (graphicsComponent instanceof Node) {
                        Node comp = (Node) graphicsComponent;
                        comp.getScene().getRoot().layout();

                        if (currMousePos == null) {
                            return false;
                        }
                        return NodeBounds.checkIfContains(new Point2D(currMousePos.x, currMousePos.y), comp);
                    }
                    Stage comp = (Stage) graphicsComponent;
                    comp.getScene().getRoot().layout();
                    Bounds stageBounds = new BoundingBox(comp.getX(), comp.getY(), comp.getWidth(),
                            comp.getHeight());
                    return stageBounds.contains(new Point2D(currMousePos.x, currMousePos.y));
                }
            });

}