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 | Field and Description |
|---|---|
| private static List | |
| private static final String | DECORATIONS_PROPERTY_KEY
* Static fields * * |
| private static Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static final void | addDecoration(Node
The node to add the decoration to. target, Decoration The decoration to add to the node. decoration)Adds the given decoration to the given node. |
| private static void | |
| private static DecorationPane | |
| public static final ObservableList | Returns: An ObservableList of the currently set decorations for the given node.The node for which all currently set decorations are required. target)Returns all the currently set decorations for the given node. |
| private static final ObservableList | |
| public static final void | removeAllDecorations(Node
The node from which all previously set decorations should be removed. target)Removes all the decorations that have previously been set on the given node. |
| public static final void | removeDecoration(Node
The node to remove the decoration from. target, Decoration The decoration to remove from the node. decoration)Removes the given decoration from the given node. |
| private static void |
| currentlyInstallingScenes | back to summary |
|---|---|
| private static List<Scene> currentlyInstallingScenes | |
| DECORATIONS_PROPERTY_KEY | back to summary |
|---|---|
| private static final String DECORATIONS_PROPERTY_KEY * Static fields * * | |
| pendingTasksByScene | back to summary |
|---|---|
| private static Map<Scene, List<Consumer<DecorationPane>>> pendingTasksByScene | |
| Decorator | back to summary |
|---|---|
| private Decorator() * Constructors * * | |
| addDecoration | back to summary |
|---|---|
| public static final void addDecoration(Node target, Decoration decoration) Adds the given decoration to the given node.
| |
| getDecorationPane | back to summary |
|---|---|
| private static void getDecorationPane(Node target, Consumer<DecorationPane> task) | |
| getDecorationPaneInParentHierarchy | back to summary |
|---|---|
| private static DecorationPane getDecorationPaneInParentHierarchy(Node target) | |
| getDecorations | back to summary |
|---|---|
| public static final ObservableList Returns all the currently set decorations for the given node.
| |
| getDecorations | back to summary |
|---|---|
| private static final ObservableList * Implementation * * | |
| removeAllDecorations | back to summary |
|---|---|
| public static final void removeAllDecorations(Node target) Removes all the decorations that have previously been set on the given node.
| |
| removeDecoration | back to summary |
|---|---|
| public static final void removeDecoration(Node target, Decoration decoration) Removes the given decoration from the given node.
| |
| updateDecorationsOnNode | back to summary |
|---|---|
| private static void updateDecorationsOnNode(Node target, List<Decoration> added, List<Decoration> removed) | |