How to include custom panel with NetBeans GUI Builder?

Curyous picture Curyous · May 3, 2009 · Viewed 43.2k times · Source

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.

Answer

Curyous picture Curyous · May 3, 2009

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

Just like it says in stackoverflow question 691890.