Managing the component palette
To use a class as a UI component in JBuilder's designers, it must be installed on the component palette. JBuilder comes with several groups of components pre-installed on different pages of the component palette or selected with the Bean Chooser
. You can add components to the existing pages, or create new pages for them.
You might want to install additional components delivered with JBuilder, components you created yourself, or third-party components. The following sections explain how to install additional components and pages on the palette, delete unused ones, and customize the palette.
Adding a component to the component palette
If your component is a JavaBean, you can add it to the component palette.
If the component is to be shared between projects, it should be added to a library that is on the CLASSPATH
in each project where it will be used.
To place the component on the component palette,
- Choose Tools|Configure Palette, or right-click a palette tab and choose Properties to display the Palette Properties dialog box.
- Select the Pages tab. In the Pages column, select the palette page on which you want your component to appear, or click the Add button to create a new page.
- Click the Add Components tab to select a class or package name.
- Press the Select Library button to open the Select A Different Library dialog box.
Select an existing library from the list or create a new one by pressing New and using the New Library wizard. Click OK to close the dialog box.
- Select the palette page to which you want the components added, then click Install to open the Browse for Class dialog.
- Select the individual classes you want from the Browse for Class dialog, then click OK.
- Click OK to close the Palette Properties dialog box when you're finished, and commit your changes.
Using the Bean Chooser button
The Bean Chooser button
is located at the left edge of the component palette under the Selection Arrow. It displays a user-defined list of beans you can drop into your UI design. When you choose a bean from the list, the Bean Chooser loads your mouse cursor with a reference to the bean, just as if you had clicked a component on the palette. When you click the design surface, it adds the bean you chose.
To add a bean to the Bean Chooser drop-down list,
- Make sure the library that contains the bean is listed as a required library for your project in the Project Properties dialog box. If not, then add the library as follows:
- Choose Project|Properties to open the Project Properties dialog box.
- Click the Required Libraries tab on the Paths page then, click the Add button.
- Select an existing library, or click the New button and add a new one to the list to choose. Click OK.
- Click the Bean Chooser button, and choose Select from the drop-down menu. This displays the Bean Chooser dialog box which contains a tree of all the available packages.
- Expand the desired node until you locate the bean you want. Select the bean and click OK.
- Click the Bean Chooser button again. Notice that a drop-down menu now appears containing the new Java Bean.
- To add another bean, click Select and repeat step 2 above.
Selecting an image for a component palette button
The image on a component palette button can be one of three things:
- An image provided by the bean itself
- A
.gif
file you select from the Item Properties dialog box
- A default image provided by JBuilder if neither of the above are provided
To select the image for your component palette button,
- Choose Tools|Configure Palette, or right-click the component palette and choose Properties to open the Palette Properties dialog box.
- Select the Pages tab.
- Select the appropriate page in the Page column and the component in the Components column.
- Double-click the component, or click the Properties button to display the Item Properties dialog box.
Note: An image of the selected component is displayed in the Item Properties dialog box to the left of the Icon options.
- Do one of the following:
- Choose Use JavaBean Icon to use the image provided by the bean for the button.
- Choose Select Image and click the Browse button to select a
.gif
file to be displayed on the button.
- Type in a new or different initialization String if you want to use a factory method or a constructor with more than one parameter instead of the default parameterless Bean constructor.
For best results, use a 32x32 .gif
file.
- Click OK to close the Item Properties dialog box.
- Click OK in the Palette Properties dialog box when you're finished.
Removing a page or component from the component palette
To remove a page or component from the palette,
- Choose Tools|Configure Palette, or right-click the component palette and choose Properties.
- Select the Pages tab in the Palette Properties dialog box.
- Select the appropriate page in the Page column and the component in the Components column.
- Click Remove, then click OK.
Reorganizing the component palette
To change the order of the pages or components on the palette,
- Choose Tools|Configure Palette, or right-click the component palette and choose Properties.
- Select the Pages tab.
- Select a page in the Page column or a component in the Components column.
- Click either Move Up or Move Down to move the selected item to a new location.
- Click OK when you are finished.