public class Decorator
extends java.lang.Object
Say you have a TextField that you want to decorate. You would simply
do the following:
TextField textfield = new TextField();
Node decoration = ... // could be an ImageView or any Node!
Decorator.addDecoration(textfield, new GraphicDecoration(decoration, Pos.CENTER_RIGHT));
Similarly, if we wanted to add a CSS style class (e.g. because we have some css that knows to make the 'warning' style class turn the TextField a lovely shade of bright red, we would simply do the following:
TextField textfield = new TextField();
Decorator.addDecoration(textfield, new StyleClassDecoration("warning");
Decoration| Modifier and Type | Method and Description |
|---|---|
static void |
addDecoration(javafx.scene.Node target,
Decoration decoration)
Adds the given decoration to the given node.
|
static javafx.collections.ObservableList<Decoration> |
getDecorations(javafx.scene.Node target)
Returns all the currently set decorations for the given node.
|
static void |
removeAllDecorations(javafx.scene.Node target)
Removes all the decorations that have previously been set on the given node.
|
static void |
removeDecoration(javafx.scene.Node target,
Decoration decoration)
Removes the given decoration from the given node.
|
public static final void addDecoration(javafx.scene.Node target,
Decoration decoration)
target - The node to add the decoration to.decoration - The decoration to add to the node.public static final void removeDecoration(javafx.scene.Node target,
Decoration decoration)
target - The node to remove the decoration from.decoration - The decoration to remove from the node.public static final void removeAllDecorations(javafx.scene.Node target)
target - The node from which all previously set decorations should be removed.public static final javafx.collections.ObservableList<Decoration> getDecorations(javafx.scene.Node target)
target - The node for which all currently set decorations are required.