Exercise 5: Importing the Beans

In this exercise you will create a new tab in the GUI builder palette and import the Clock, Marquee, and SoundPlayer beans to the palette.

Create a New Palette Tab

In this part of the exercise you are going to create a new tab called Beans.
  1. Choose GUI -> Import Components to Palette.
  2. Click New Folder under the Palette Components list.
  3. Type Beans in the Folder text box and click OK in the Name new palette folder dialog box.
  4. Look in the list of palette components to verify that the Bean folder was created.
Keep the Import Components to Palette dialog box open and proceed to the next part of the exercise, Import the Beans.

Import the Beans

When you import the beans in Clock.jar, you will place them in the new Beans tab of the palette:
  1. Click the Browse button on the JAR tab.
  2. Load the Clock.jar file in your Clock project directory.
  3. In the JAR page, select Clock.class, Marquee.class, and SoundPlayer.class.
  4. Click on the Beans folder name in the Palette Components list.

    The Add button is activated when both the class and the folder names are selected.

  5. Click the Add button that is between the JAR tab and the Palette Components list.
  6. Check the components list to see if the beans have been added to the Beans folder.
  7. Click OK to add the beans to the palette.
  8. In the GUI builder palette, click the Beans tab.

    You should see custom icons for Clock and Marquee and a default icon for SoundPlayer.

    
    
You have successfully imported the beans into the palette. When the beans were imported, shadow classes were automatically generated for each bean class and added to the JAR file. This modified version of the JAR file was then stored in the component library (the Imported Components directory).

Next lesson:

Exercise 6: Designing DeskClock