public class JFXUtil extends Object
Constructor and Description |
---|
JFXUtil() |
Modifier and Type | Method and Description |
---|---|
static javafx.scene.layout.StackPane |
createScalePane(javafx.scene.layout.Region region,
double w,
double h,
boolean override)
Creates a "Scale Pane", which is a pane that scales as it resizes, instead of reflowing layout
like a normal pane.
|
static double |
getXShift(javafx.scene.Node descendant,
javafx.scene.Node ancestor)
Find the X coordinate in ancestor's coordinate system that corresponds to the X=0 axis in
descendant's coordinate system.
|
static double |
getYShift(javafx.scene.Node descendant,
javafx.scene.Node ancestor)
Find the Y coordinate in ancestor's coordinate system that corresponds to the Y=0 axis in
descendant's coordinate system.
|
static void |
replaceComponent(javafx.scene.Node original,
javafx.scene.Node replacement)
Make a best attempt to replace the original component with the replacement, and keep the same
position and layout constraints in the container.
|
public static double getXShift(javafx.scene.Node descendant, javafx.scene.Node ancestor)
descendant
- a Node that is a descendant (direct or indirectly) of the ancestorancestor
- a Node that is an ancestor of descendantpublic static double getYShift(javafx.scene.Node descendant, javafx.scene.Node ancestor)
descendant
- a Node that is a descendant (direct or indirectly) of the ancestorancestor
- a Node that is an ancestor of descendantpublic static void replaceComponent(javafx.scene.Node original, javafx.scene.Node replacement)
Currently this method is probably not perfect. It uses three strategies:
BorderPane
, preserve the positionThis method does not transfer any handlers (mouse handlers for example).
original
- non-null Node whose parent is a Pane
.replacement
- non-null Replacement Nodepublic static javafx.scene.layout.StackPane createScalePane(javafx.scene.layout.Region region, double w, double h, boolean override)
If the region has an explicitly set preferred width and height, those are used unless override is set true.
If the region already has a parent, the returned pane will replace it via the
replaceComponent(Node, Node)
method. The Region's parent must be a Pane in this case.
region
- non-null Regionw
- default width, used if the region's width is calculatedh
- default height, used if the region's height is calculatedoverride
- if true, w,h is the region's "100%" size even if the region has an explicit
preferred width and height set.Copyright © 2013–2016 Jason Winnebeck. All rights reserved.