Question

How can I add NewJPanel, a Netbeans generated class which extends JPanel, to the palette for the GUI builder?

The goal is to be able to add a NewJPanel through the palette so that it has type NewJPanel rather than type JPanel. However, it's not available through the palette as I would expect.

I'm following:

To install via Palette Manager

Open the Palette Manager from main menu: Tools | Palette Manager | Swing/AWT Components
In the Palette Manager press button according to where the component comes from. The choices are: 

    from an external JAR file
    from a library defined in the IDE (always create a library if the components need more than one JAR)
    from a NetBeans project

from the Netbeans FAQ's.

This method doesn't work because the classes just aren't available for selection.

However, I was able to drag NewJPane onto the design view of NewJFrame where it was declared with the correct type of NewJPane (and not JPane).

enter image description here

Was it helpful?

Solution

You can add your custom component to the matisse GUI palatte.

Build your project so the class file you want to use is part of the jar file
Open a java class that has a form, and switch to design mode. 3, Right click in the palatte and choose "palatte manager".
Choose the "add from jar" button to select your jar.
Choose the class you made, and add it to your palatte.

Now your panel is known to netbeans, and you can drag it into new panels.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top