Example usage for javafx.scene Node getLayoutBounds

List of usage examples for javafx.scene Node getLayoutBounds

Introduction

In this page you can find the example usage for javafx.scene Node getLayoutBounds.

Prototype

public final Bounds getLayoutBounds() 

Source Link

Usage

From source file:Main.java

/**
 * Returns the dimensions of the component's layout bounds
 * @param pFxComponent/* ww w  .j  a  v a  2 s . co  m*/
 * @return
 */
public static Dimension getDimensionOfComponent(final Node pFxComponent) {
    return convertToDimension(pFxComponent.getLayoutBounds());
}

From source file:Main.java

public void placeMarker(Node newNode) {
    double nodeMinX = newNode.getLayoutBounds().getMinX();
    double nodeMinY = newNode.getLayoutBounds().getMinY();
    Point2D nodeInScene = newNode.localToScene(nodeMinX, nodeMinY);
    Point2D nodeInMarkerLocal = marker.sceneToLocal(nodeInScene);
    Point2D nodeInMarkerParent = marker.localToParent(nodeInMarkerLocal);

    marker.relocate(nodeInMarkerParent.getX() + marker.getLayoutBounds().getMinX(),
            nodeInMarkerParent.getY() + marker.getLayoutBounds().getMinY());
}

From source file:Main.java

public void focusChanged(ObservableValue<? extends Node> value, Node oldNode, Node newNode) {
    // Focus has changed to a new node
    String microHelpText = (String) newNode.getProperties().get("microHelpText");

    if (microHelpText != null && microHelpText.trim().length() > 0) {
        helpText.setText(microHelpText);
        helpText.setVisible(true);//w  w  w  .j  av  a2 s  . c om

        // Position the help text node
        double x = newNode.getLayoutX() + newNode.getLayoutBounds().getMinX()
                - helpText.getLayoutBounds().getMinX();
        double y = newNode.getLayoutY() + newNode.getLayoutBounds().getMinY()
                + newNode.getLayoutBounds().getHeight() - helpText.getLayoutBounds().getMinX();

        helpText.setLayoutX(x);
        helpText.setLayoutY(y);
        helpText.setWrappingWidth(newNode.getLayoutBounds().getWidth());
    } else {
        helpText.setVisible(false);
    }
}