views:

138

answers:

1

This is similar to this question, except the code is already written.

I have

JFrame
  JTabbedPane
    JPanel X
      <...>
    JPanel Y
      <...>
    JPanel Z
      <...>

all defined in the same class, but I want to move each panel into its own .java file. I really don't want to manually copy-paste from the underlying .form and .java files if I don't have to. Each panel is mostly decoupled from the others already, which is why I want to create separate files for each.

What is the best way to split this into four separate classes (1 JFrame, 3 JPanels) using NetBeans so that it will move all of its autogenerated code correctly?

+1  A: 

Create a new JPanelX class in Netbeans. Then copy-paste the contents of JPanel X into JPanelX. Repeat for each of the others.

Then in JFrame, remove the JPanel's and replace them with your new JPanelX, etc.

James Schek