DecorationDelegate works with the
DecorationSupport interface to allow any Region supporting
decorations.
To do it, implement DecorationSupport on a Region subclass. In the Region subclass, you add the following
code.
private DecorationDelegate _decorationDelegate;
// initialize it somewhere in the constructor
_decorationDelegate = new DecorationDelegate(this);
protected void layoutChildren() {
_decorationDelegate.prepareDecorations();
super.layoutChildren();
Platform.runLater(new Runnable() {
public void run() {
_decorationDelegate.layoutDecorations();
}
});
}
public ObservableList<Node> getChildren() {
return super.getChildren();
}
public void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double
areaBaselineOffset, HPos halignment, VPos valignment) {
super.positionInArea(child, areaX, areaY, areaWidth, areaHeight, areaBaselineOffset, halignment, valignment);
}