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:

  1. 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).
  2. Save and close the form.
  3. Open only the java file in the Source view (use Edit action from context menu).
  4. Change the superclass to the desired class (javax.swing.JPanel).
  5. Save and close the java file.
  6. Open the form again -- the code is regenerated for the new type automatically (in our case all getContentPane() calls disappear).
  7. Save the form and you are done.

Source: NetBeans User FAQ