java.lang.Object
org.controlsfx.control.decoration.Decorator

public class Decorator extends Object
The Decorator class is responsible for accessing decorations for a given node. Through this class you may therefore add and remove decorations as desired.

Code Example

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");
 
See Also:
  • Method Details

    • addDecoration

      public static final void addDecoration(javafx.scene.Node target, Decoration decoration)
      Adds the given decoration to the given node.
      Parameters:
      target - The node to add the decoration to.
      decoration - The decoration to add to the node.
    • removeDecoration

      public static final void removeDecoration(javafx.scene.Node target, Decoration decoration)
      Removes the given decoration from the given node.
      Parameters:
      target - The node to remove the decoration from.
      decoration - The decoration to remove from the node.
    • removeAllDecorations

      public static final void removeAllDecorations(javafx.scene.Node target)
      Removes all the decorations that have previously been set on the given node.
      Parameters:
      target - The node from which all previously set decorations should be removed.
    • getDecorations

      public static final javafx.collections.ObservableList<Decoration> getDecorations(javafx.scene.Node target)
      Returns all the currently set decorations for the given node.
      Parameters:
      target - The node for which all currently set decorations are required.
      Returns:
      An ObservableList of the currently set decorations for the given node.