You can now add components to the LookandFeel form created in the previous section. You start by adding and customizing a JavaBeans component. (JavaBeans components are referred to simply as beans.)
You will not find this bean in the Component Palette. It was developed specifically for this tutorial and it must be added using the Explorer window. (Later in this tutorial you will learn how to add this bean to the Component Palette, making it as easily accessible as the standard user interface components.)
To add the bean:
In selection mode you can easily add components to a form by selecting an item in the Component Palette, then clicking the form where it is to be placed. The arrow icon is selected (as shown below) when selection mode is active.
The bean's package name, tutorial.lookandfeel.radiobuttongroup, corresponds to this directory structure.
Be sure to right-click the bean node, RadioButtonGroupPanel, not the directory node, radiobuttongroup.
The Component Inspector now includes a node named radioButtonGroupPanel1 for the RadioButtonPanelGroup bean. The form updates to display the bean.
To customize the bean:
The Properties tab is selected (by default) and some of the bean's properties are listed in the left column.
A property editor opens.
new String[] {"Java", "Microsoft Windows", "CDE"}This statement initializes an array of strings and each string must be quoted. After typing the statement, click OK.
A property editor opens.
If the selection property is not set in the property editor, the first label added determines the initial selection. Since the Java label was added first, the default initial selection is the Java button.
A property editor opens.
The form updates to display the new border title.
Next:![]() Back: ![]() |