ese es el codigo con el que agrego el panel:
Código:
este es el de la clase jcPanel:jcPanel panel = new jcPanel(); _jpanelcontenedor.add(panel.nuevoPanel()); JOptionPane.showMessageDialog(null, _jpanelcontenedor.getComponentCount());
Código:
public class jcPanel { public jcPanel() { } public JPanel nuevoPanel() { JPanel panel = new JPanel(); panel.setBackground(new java.awt.Color(0, 0, 204)); panel.setSize(200, 200); panel.setLocation(50, 500); GroupLayout jPanelLayout = new GroupLayout(panel); panel.setLayout(jPanelLayout); jPanelLayout.setHorizontalGroup(jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 380, Short.MAX_VALUE)); jPanelLayout.setVerticalGroup(jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 278, Short.MAX_VALUE)); return panel; } }