tenho uma jframe o que quero fazer é quando clicar num botao ela carrega um class que é uma jpanel para uma jpanel
codigo para adicionar o jpanel
[code]
public class adduser extends javax.swing.JPanel {
/** Creates new form adduser */
public adduser() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(pombalingua.PombalinguaApp.class).getContext().getResourceMap(adduser.class);
setBackground(resourceMap.getColor("Form.background")); // NOI18N
setName("Form"); // NOI18N
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(jLabel1)
.addContainerGap(337, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jLabel1)
.addContainerGap(262, Short.MAX_VALUE))
);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
// End of variables declaration
}[/code]
o que estou a fazer mal??