Although VisualAge enables you to compose and generate user interface beans, you will probably want to write other beans yourself at some point. These are typically nonvisual beans that provide business logic. You can either create a new bean and write the code to support its features, or you can define bean interface features for code you have already written.
If you just need to extend the function of the bean, you can probably accomplish this by using code connections. As a last resort, you can modify generated code for the bean.
Before you get started, read the related conceptual topic about generated code.
For properties, generated feature code is usually sufficient without modification. For method features, you must modify the feature code to add the behavior you want your bean to provide.
You can modify the feature code in the Source pane of either the Methods page or the BeanInfo page. If you choose to modify feature code for visual composites, be sure to stick to the designated user-code areas marked. Otherwise, VisualAge will overwrite your code the next time the bean is saved.
If you need to modify the signature for a method that supports a feature, follow these steps:
Before you get started, read the related conceptual topic about generated code.
If you add public methods on the Methods page, you can add them as features on the BeanInfo page. To add methods as features, select Add Available Features from the Features menu. Then, select the methods you want to add as features.
If you add a new method feature with the same name as a method you have already written, VisualAge uses the existing method. Otherwise, it generates a new method stub.
Visual, Nonvisual, and Composite Beans
Code Connections
Generated Code
Defining Bean Interfaces for Visual Composition
How Generated Code Coexists with User-Written Code
Importing Classes from the File System
Generated BeanInfo Descriptor Code (an advanced topic)