Duvida com jpanel

0 respostas
jonasjgs2

boa tarde a todos,
Eu criei um jpanel e dentro dele criei um jbutton
eu utilizo o netbeans
então peguei este jpanel e coloquei ele na paleta do netbeans
ate ai tudo bem
ate já estou acostumado a fazer isso...

porem quando eu crio um jframe e arrasto o meu painel para dentro do jframe o mesmo aparece la
bonitinho com o meu jbutton sem nenhum problema.

só que eu não consigo arrastar nenhum componente da paleta para dentro dele...
o componente sempre fica fora do meu jpanel...

o que pode estar acontecendo:

segue o meu jpanel...

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package objetos;

/**
 *
 * @author Admin
 */
public class JgsPainel3 extends javax.swing.JPanel {

    /**
     * Creates new form JgsPainel3
     */
    public JgsPainel3() {
        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() {

        jButton1 = new javax.swing.JButton();

        jButton1.setText("jButton1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton1)
                .addContainerGap(321, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(jButton1)
                .addContainerGap(257, Short.MAX_VALUE))
        );
    }// </editor-fold>                        


    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    // End of variables declaration                   
}
Criado 10 de julho de 2015
Respostas 0
Participantes 1