public class NodeUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addToParent(Parent p,
Node n)
Adds the given node to the specified parent.
|
static Node |
getNode(Parent p,
double sceneX,
double sceneY,
Class<?> nodeClass)
Returns the first node at the given location that is an instance of the
specified class object.
|
static void |
removeFromParent(Node n)
Removes the specified node from its parent.
|
static double |
screenX(Node node) |
static double |
screenY(Node node) |
static double |
snapWH(double position,
double offset)
This method prevents blurry horizontal or vertical lines, use snapWH(x,
w) instead of w.
|
static DoubleBinding |
snapWH(ObservableNumberValue position,
ObservableNumberValue offset,
Observable... dependencies)
This is the snapXY method for using in a binding, for example: p1.bind(
snapXY( p2.multiply(0.1) ));
|
static double |
snapXY(double position)
This method prevents blurry horizontal or vertical lines, use snapXY(x)
instead of x.
|
static DoubleBinding |
snapXY(ObservableNumberValue position)
This is the snapXY method for using in a binding, for example: p1.bind(
snapXY( p2.multiply(0.1) ));
|
public static double screenX(Node node)
node - public static double screenY(Node node)
node - public static void removeFromParent(Node n)
n - the node to removeIllegalArgumentException - if an unsupported parent class has been
specified or the parent is nullpublic static void addToParent(Parent p, Node n)
p - parentn - nodeIllegalArgumentException - if an unsupported parent class has been
specified or the parent is nullpublic static Node getNode(Parent p, double sceneX, double sceneY, Class<?> nodeClass)
p - parent nodesceneX - x coordinatesceneY - y coordinatenodeClass - node class to search fornull if no such node existpublic static double snapXY(double position)
position - (x or y)public static DoubleBinding snapXY(ObservableNumberValue position)
position - (x or y)public static double snapWH(double position,
double offset)
position - (x or y)offset - (width or height)public static DoubleBinding snapWH(ObservableNumberValue position, ObservableNumberValue offset, Observable... dependencies)
position - (x or y)offset - (width or height)dependencies -