# Adding Custom Components and Windows

You can add your own custom windows and components to the layout (without having to add them to a palette):

- Generic Component. Creates a particular type of component when you specify a component class in the attribute editor and set its attributes.
- Generic Window. Creates a top-level window when you specify a frame or dialog class in the attribute editor and set its attributes.

To add a custom component with Generic Component:

1. Click on Generic Component in the Additional palette.
2. Click in the cell where you want to place the component.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Use the `class` attribute to specify your custom component by its full package and class name. By default, the `class` attribute of Generic Component contains `java.awt.Button`, the standard AWT button object.

   The component must have a null constructor, and it must be a subclass of `java.awt.Component`.

5. Enter a unique component ID in the name box.

Using Generic Component does not integrate your component into the GUI builder component palette.

To add a custom window to the layout:

1. Choose GUI -> Add New Window to open the New Window dialog box.
2. Choose Generic Window from the list.
3. Click Create.
4. Select Generic Window in the mode list (next to the component palette) to open the attribute editor.
5. Use the `class` attribute to specify your custom window by its full package and class name.

   By default, the Generic Window `class` attribute contains `sunsoft.jws.visual.rt.awt.RootFrame`. Your custom window must be a subclass of `sunsoft.jws.visual.rt.awt.RootFrame` or `sunsoft.jws.visual.rt.awt.RootDialog`

See Defining Attributes for information on defining attributes for custom shadows or groups.

See also:

  Importing Components
  Generating Java Source Code
  Adding Operations to Components
  What Is a Component Operation?
  GUI Builder Runtime Classes
  GUI Builder Palette

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