Documentation
Custom Property Values
Custom values allow you to use values specified in own code as property values in Properties view.
Two types are supported:
Instance Values¶
A new instance of a class is created as property value.
An instance class must extend property type, must be public and must have a public no-args constructor.
Example:
public class MyIcon implements Icon { @Override public int getIconWidth() { return 16; } @Override public int getIconHeight() { return 16; } @Override public void paintIcon( Component c, Graphics g, int x, int y ) { g.setColor( Color.green ); g.fillOval( x, y, 16, 16 ); } }
Generated source code in form that uses above icon:
label.setIcon(new MyIcon());
Factory Values¶
A field or a getter method of factory class is used to get property value.
A factory class must be public, must have public static fields of property type or public static no-args methods that return property type.
Example:
public class MyFactory { public static final Color MY_COLOR_1 = new Color( 192, 0, 0 ); public static Color myColor2() { return new Color( 128, 0, 0 ); } }
Generated source code in form that uses above factory:
label.setForeground(MyFactory.MY_COLOR_1);
label.setBackground(MyFactory.myColor2());
Usage¶
Right-click on property in Properties view and select Custom Value.

To use an instance value, select a class that extends the property type:

To use a factory value, first select a factory class and then choose a field or getter method:

You can quickly apply recently used custom values by using the Recent Custom Values submenu:
