Java examples for JavaFX:Layout
Returns the dimensions of the JavaFX component's layout bounds
//package com.java2s; import java.awt.Dimension; import javafx.geometry.Bounds; import javafx.scene.Node; public class Main { /**/*from ww w . j a v a 2 s .c o m*/ * Returns the dimensions of the component's layout bounds * @param pFxComponent * @return */ public static Dimension getDimensionOfComponent(final Node pFxComponent) { return convertToDimension(pFxComponent.getLayoutBounds()); } /** * Converts a Bound to a Dimension. Note that some information will be * lost (depth, x, y, etc) yet the width and height will be preserved * @param pBound * @return */ public static Dimension convertToDimension(Bounds pBound) { Dimension result = new Dimension(); result.setSize(pBound.getWidth(), pBound.getHeight()); return result; } }