This requires to change the form superclass. It is not supported directly, but it can be achieved by the following steps. For example, we want to change a JFrame form to JPanel form:
- Open the JFrame form and remove everything incompatible with the target type (in our case remove windowClosing event, and also menubar if set, which cannot be used in JPanel).
- Save and close the form.
- Open only the java file in the Source view (use Edit action from context menu).
- Change the superclass to the desired class (javax.swing.JPanel).
- Save and close the java file.
- Open the form again -- the code is regenerated for the new type automatically (in our case all getContentPane() calls disappear).
- Save the form and you are done.
Source: NetBeans User FAQ