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
Simply drag the class from the projects tree on to the form in the GUI designer.
Just like it says in stackoverflow question 691890.
Just provide a public no-arg constructor for your class. You can then add the class to the Palette by right clicking on it and selecting Add to Palette.
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.