Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include custom panel with NetBeans GUI Builder?

Tags:

I have written a class that extends JPanel. Is it possible to use this in the NetBeans GUI Builder and have it survive all of the automatic code generation?

I have used the customised code option in the GUI builder to instantiate the object as the new class, but it seems like the declaration can't be changed from JPanel, so only methods that I have overridden get called, I can't call new ones that are not present in JPanel.

like image 236
Curyous Avatar asked May 03 '09 03:05

Curyous


2 Answers

Simply drag the class from the projects tree on to the form in the GUI designer.

Just like it says in stackoverflow question 691890.

like image 55
Curyous Avatar answered Oct 08 '22 08:10

Curyous


You can use the Palette Manager to add your component to the palette, then you can use it in the GUI builder as you would any other class.
See How can I use a custom subclass of a Swing component? in the NetBeans Wiki.

like image 22
Michael Myers Avatar answered Oct 08 '22 08:10

Michael Myers