In the Projects window, find the class for your bean, expand its node,
and right-click Bean Patterns.
From the pop-up menu, choose Add >
or Add > .
The New Property Pattern or New Indexed Property Pattern dialog box appears,
enabling you to customize the code to be generated for the property.
Type in a name for the property. The name must be a valid Java identifier.
When the property is generated, get is added as a prefix to the
property name for the getter method and set is added as a prefix
for the setter method. For Boolean properties, the IDE adds is
to the property name for the getter method.
In the Type combo box, select the type of property from the list, or type
in a class identifier.
In the Mode combo box, select Read Only to generate the getter method,
Write Only to generate the setter method, or Read/Write to generate both.
Select or both options if applicable.
The usefulness of these options is enhanced if you also select the Generate
Property Change Support option as described in Step 7.
Select any combination of these options in the New Property Pattern dialog
box:
Generate Field. Generates a private field with the same name
and type as the property.
Generate Return Statement. Inserts code in the body of the getter
method that returns the field, such as return myProperty;
Generate Set Statement. Inserts code in the body of the setter
method that sets the value of the property field to the value of the setter
parameter.
Generate Property Change Support. Generates all code needed
for firing PropertyChangeEvents for bound properties and VetoableChangeEvents
for constrained properties. Code to declare and initialize the property
change support object is also generated.
If you are creating an indexed property, each getter and setter method that is generated
with these four options includes a parameter for the index of the element
to be read or written. In addition, you can select Non-Index Options to generate
getter and setter methods that apply to all elements of the array.
Click OK to generate the component property methods for the selected class.