If you are just getting started, read the following concept topics:
You can perform the following tasks to modify your beans:
The property sheet for a bean provides a way to display and set initial property values for the bean. Changes made to values in the property sheet are applied immediately.
You can edit the properties for a single bean or select several beans and open a property sheet for them. When you change a property on the property sheet, the change affects all the selected beans.
If you modify a setting and change your mind, click the Reset button and a secondary window appears listing the properties you have modified. Select the box next to each property you want to reset, click OK, and VisualAge returns the value to the default setting.
Some of the tasks you can perform include:
To change the properties for a single bean, follow these steps:
To change the properties for multiple beans (multiple selection), follow these steps:
Once you open a property sheet, you can modify properties for most beans in the Visual Composition Editor. To open the properties on another bean select it in the Visual Composition Editor. To select if from within the property sheet:
Note: |
If a common property is not visible on the property sheet, select the Show expert features check box. To enable national language support for your composite, be sure to read Separating strings for translation. |
Some bean properties on the property sheet, such as border
and model, use interface editors. If the property has an interface
editor, a small button,
which indicates a secondary window, appears to the right when you select the
value field for that property. When you select the
, the interface editor for that property appears.
The interface editor provides two options: Code String and Bean Implementing Interface. To enter your own code string for the property, select Code String and type your code in the entry field. To see a list of available interfaces, select Bean Implementing Interface. From the drop-down list, select the desired interface for that property and modify any values listed.
VisualAge enables you to set some bean properties using code strings. Curly braces, { }, in the value column of a bean property sheet indicate that you can type Java code directly into the property field.
For example, you can use code strings to dynamically instantiate a dialog window when the user selects a button.
This string directs VisualAge to create a new instance of MyDialog when the button is selected.
Visual beans have color properties for the foreground and background. To change a color property of a bean in its property sheet, do the following:
When you change bean colors, select colors that are available across various platforms.
For an example, open the background property in the property sheet for any of the com.ibm.ivj.examples shipped in the IBM Java Examples project.
Note: | If you are setting the background property of a Swing bean, be sure the opaque property of the bean is set to true. |
To change the font of a bean in its property sheet, do the following:
When you change bean fonts, select fonts that are available across various platforms.
For an example, open the font property in the property sheet for any com.ibm.ivj.examples.vc. class shipped in the IBM Java Examples project.
If a bean is embedded in a container that does not use a layout manager (null layout), you can change the x and y coordinates, the width, and the height using the bean property sheet. To modify the size and position features, do the following:
Note: | If you specify a non-null layout for the container, the bean position and sizing constraints are affected by that layout manager. |
When you open the bean property sheet using multiple selection, some size and position constraints may appear stippled rather than solid because the values for the field are not common to all the selected beans. Once you modify the constraint, however, all the selected beans have the same value and the constraint appears solid.
For an example of the different layout managers, see the COM.ibm.ivj.examples.vc.layoutmanagers.LayoutManagers class shipped in the IBM Java Examples project.
Some visual beans, such as JLabel and JButton, have icon properties. You can assign an icon to these beans through the property sheet.
To add an icon to a visual bean:
Note: | When you export your bean using the export SmartGuide, assure that the icon file is specified as a resource. |
Some visual beans, such as buttons and menus, contain text strings. You can edit these labels through the property sheet.
To edit the text of a label:
To see a menu of operations you can perform on a bean, click mouse button 2 on the bean. The pop-up menu for the bean appears. Choices on the pop-up menu allow you to delete the bean, rename it, and perform other operations (which vary, depending on the bean).
To display a pop-up menu for multiple beans:
Note: | When you open a pop-up menu for multiple selected beans, one menu displays the choices common to all selected beans. Operations performed from that pop-up affect all selected beans. |
The Beans List window displays an ordered list of the beans and connections on the free-form surface. The beans are initially listed in the order in which they were dropped, which also reflects the tabbing order. If you change the order of beans that have tabbing set, the Visual Composition Editor reflects the updated tabbing order.
To view the beans list, select Beans List from the tool bar or
select
from the Tools pull-down menu.
You can perform the following tasks within the beans list:
The Visual Composition Editor assigns default names to distinguish beans and connections when you generate the code to build your program element. For example, for each bean, VisualAge generates a get method that you should use to access the bean within user methods or code. In addition to use in generated methods for beans and connections, the names for selected beans and connections appear in the information area at the bottom of the Visual Composition Editor.
The Visual Composition Editor assigns bean names based on the bean palette name or the name you specify when you use the Choose Bean tool. For example, VisualAge names the first button bean that you drop Button1, the second Button2, the third Button3, and so forth. When you select this bean, the information area at the bottom of the Visual Composition Editor displays the message Button1 selected.
The Visual Composition Editor assigns connection names based on the type of connection. For example, the first property-to-property connection is named connPtoP1, the second is connPtoP2, etc. All other connection types receive their names similarly. For example, an event-to-code connection is named connEtoC1, an event-to-method is named connEtoM1, etc.
To assign bean or connection names that are more descriptive or meaningful to your program element, follow these steps:
To view the changes outside the Visual Composition Editor, you must regenerate the code.
You can also rename beans in the property sheet and you can change bean or connection names from the pop-up in the Beans List.
Note: | When you name a bean, take into account that VisualAge uses the name of the bean in generating get methods. For example, if you name a torn-off property font, the generated method getFont overrides the inherited method. |
Visual Composition Editor overview
Property sheets
Arranging beans visually
Advanced visual bean tasks
Opening the property sheet for a bean
Visual Composition Editor
Pop-up menus for the Visual Composition Editor
Beans List