= Dynamic Custom Graphics Example 1: Gradient Bar = {{{#!java public class GradientRectangleCustomGraphics extends AbstractCyCustomGraphics { private static final String NAME = "Gradient Round Rectangle"; private static final String WIDTH = "Width"; private static final String HEIGHT = "Height"; private static final String COLOR1 = "Color 1"; private static final String COLOR2 = "Color 2"; private final CustomGraphicsProperty w; private final CustomGraphicsProperty h; private final CustomGraphicsProperty c1; private final CustomGraphicsProperty c2; public GradientRectangleCustomGraphics() { super(NAME); w = new CustomGraphicsPropertyImpl(WIDTH, 60f); h = new CustomGraphicsPropertyImpl(HEIGHT, 150f); c1 = new CustomGraphicsPropertyImpl(COLOR1, Color.white); c2 = new CustomGraphicsPropertyImpl(COLOR2, Color.darkGray); this.props.add(w); this.props.add(h); this.props.add(c1); this.props.add(c2); this.tags.add("vector image"); buildCustomGraphics(); } private void buildCustomGraphics() { cgList.clear(); final GradientPaint gradient = new GradientPaint(w.getValue()/2, 0, c2.getValue(), w.getValue()/2, h.getValue()/2, c1.getValue()); final RoundRectangle2D bound = new RoundRectangle2D.Double(-w.getValue() / 2, -h.getValue() / 2, w.getValue(), h.getValue(), 20, 20); final CustomGraphic cg = new CustomGraphic(bound, gradient, NodeDetails.ANCHOR_CENTER); cgList.add(cg); } } }}}