Importing Components

You can import a component into GUI builder in the following ways: See Customizing the Component Palette for information on rearranging, removing, or renaming tabs or components in the palette.

To import a JAR file:

  1. Choose GUI -> Import Components to Palette to open the Import Components To Palette dialog box.
  2. Click the JAR tab.
  3. Click on the Browse button next to the text box to select and load the desired JAR file from the file chooser.

    You can also type the absolute path name of the JAR file in the Select JAR file text box. Press Return or Enter to load the JAR file.

  4. Select a class name from the JAR file list.
  5. Select a folder name in the Palette Components list and click Add to include the bean in the palette.

    When you click Add, a shadow class (which allows JWS to manipulate the bean) is generated and automatically inserted into the JAR file. The JAR file is then added to the Imported Components directory.

  6. (Optional) You can change the Tool Tip and Footer labels for the bean:
    1. select the bean's name in the Palette Components list and click Customize.
    2. In the pop-up window, type the Tool Tip and Footer labels for the component.
  7. Click OK in the Import Components To Palette dialog box to add the bean to the palette.

To manually create a shadow class:

  1. Choose the appropriate base shadow class from which your shadow class will be derived.

    You might try choosing the shadow class that corresponds to the parent class of the class being wrapped.

  2. Write a .java file to create the shadow class and hook it up to the component class. This step involves writing "get" methods and "set" methods for the component class.
  3. Compile the shadow.java file to generate a shadow.class file.

When you write a custom component and add new shadow classes or group classes, all the standard component attributes are available (for example, foreground, background colors, font), since a new shadow or group class extends an already existing class. Any new attributes specific to the custom component are also available through the attribute editor.

You must define attributes for custom shadows or groups in the constructor method of the class. A source code example, LabelShadow (the shadow class for labels), shows you how to write a shadow class and demonstrates how attributes are defined. Look for the attributes.add calls. LabelShadow extends ComponentShadow, and so inherits all of the attributes of ComponentShadow.


GUI builder group and shadow classes are discussed in What Are Groups and Shadows? and More on Groups and Shadows.

To import the shadow class:

  1. Choose GUI -> Import Components to Palette to open the Import Components to Palette dialog box.
  2. Click the Shadow tab.
  3. Fill in the text boxes:
  4. In the Palette Components list, select the name of the palette folder to contain the component.
  5. Click Add.
  6. Click on the up or down arrows to position the component in the palette.

To see what component classes are currently in use in your project, choose Class Usage Report from the GUI menu for a list of class names and their sources.

For an example of how a component is imported, see the card file example, Card File - Examples of Creating an Application.

See also:

Customizing the Component Palette

Visual Java GUI Builder API Documentation
Visual Java GUI Builder Runtime Packages
Class Hierarchy
Index of All Fields and Methods