Using Custom Beans in the Form Editor


In addition to the standard Swing and AWT components available in the palette, you can also build your own custom components and add them to the palette.

To add a component to the palette:

  1. If you are developing the component palette in an IDE project, build the project.

  2. Choose Tools | Palette Manager | Swing/AWT Components.

  3. Click one of the following to specify the component location:

    Add from JAR. Choose this option if the component is in a built library.

    Add from Library. Choose this option if the component is in one of the libraries registered in the Library Manager.

    Add from Project. Choose this option if the form is in an IDE project. If you choose this option, the IDE adds the project containing the component to the present project's classpath. Whenever you build your project, the component's project is built as well.

  4. Click Next. The wizard displays all JavaBeans components in the specified location.

  5. Select the component and click Next.

  6. Specify the palette category for the component and click Finish.

If the project containing the component is open in the IDE, you can right-click the component's node in the Projects window and choose Tools | Add to Palette.


Associating an Icon with a Component

If you develop a component that you want to add to the Palette window, you can easily associate an icon with the component. The icon is then displayed with the component in the Palette window.

To associate an icon with a component:

  1. In the Projects window, expand the class node that contains your component.

  2. Right-click the Bean Patterns subnode and choose BeanInfo Editor from the pop-up menu.

  3. In the BeanInfo Editor, select the BeanInfo node. Properties are displayed in the right panel for all four icon types, as shown in Figure 6-11.

    Figure 6-11. The BeanInfo Editor for a component

  4. Use the icon properties to set the small and large icons for the component.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net