Generating Accessor Methods for Fields Bound to Data
If you have fields in the UI class that you want bound to some data in a JavaBean class, IntelliJ IDEA provides a special Data Binding Wizard. This wizard helps generate getData and setData methods for the fields in a UI class that are bound to components in a GUI form. You can create data binding to an existing bean class, or create a new bean class on the fly using the wizard.
For example, suppose you have some JTextField components on a GUI form that are bound to fields in a UI class, and you want the value of their text properties bound to some data in a JavaBean class. Instead of editing the UI class, creating getData and setData methods for the fields, being careful to specify the fully qualified name of the correct bean class and importing the required package, just use the Data Binding Wizard.
When you finish the wizard, the specified accessor methods are written to the form's class according to the options you specified in the wizard. Import statements are generated in the class as necessary.
Once components have been bound to data, you can invoke the Data Binding Wizard again, in which case you are presented with options to either remove the data binding, or bind to a different bean. If you choose the latter option, the wizard enables you to select or create the bean class for the data binding. The source code of the UI class (including imports) is modified according to your choices and specifications.
To bind a component to data
Make sure that your form contains components that are eligible for data binding.
On the context menu of the form, choose Data Binding Wizard, or click on the GUI Designer toolbar.
On the first page of the wizard, specify whether to bind to data from a new bean or an existing bean, specify the class for the option you choose, and click Next.
The second page lists the form components that are eligible for data binding, and that have been bound to a field in the form's UI class. For each component name, click the Bean Property field to the right, and specify the bean property that you want as the data source/target for the component.
Click Finish to complete the data binding operation.