Problema para inserir um registro JAVA/MYSQL

Sou novo no Forum, mas ja dei uma olhada e não consegui resolver o meu problema. Não consigo fazer um Insert… alguém pode me ajudar? segue meu código:

public void Inserir(){
try{
ps = (PreparedStatement) conn.createStatement().executeQuery(“INSERT INTO DadosUsuario VALUES(?, ?, ?)”);
ps.setInt(1, 1);
ps.setString(2,“Jayson”);
ps.setString(3, “145”);
ps.executeUpdate();
}catch(SQLException e){
e.printStackTrace();
}

}

Dá esse erro:
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.Statement.checkForDml(Statement.java:398)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1075)
at Gerenciar.Inserir(Gerenciar.java:21)
at Cadastro.actionPerformed(Cadastro.java:62)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

public void Inserir(){
try{
ps = conn.createStatement(“INSERT INTO DadosUsuario VALUES(?, ?, ?”);
ps.setInt(1, 1);
ps.setString(2,“Jayson”);
ps.setString(3, “145”);
ps.execute();
}catch(SQLException e){
e.printStackTrace();
}

}
Tua Sql ta faltando campos tambem ficaria assim
INsert into DadosUsuario(campo1,campo2,campo3)values(?,?,?),

Ola,

faça

PreparedStatement ps = con.prepareStatement("INSERT INTO DadosUsuario VALUES(?, ?, ?)");
ps.setInt(1, 1);
ps.setString(2,"Jayson");
ps.setString(3, "145");
ps.executeUpdate();

Cara … você está fazendo um executeQuery("…") e logo abaixo esta fazendo um ps.executeUpdate();

faça uma coisa de cade vez…
1º cria a conexão;
2º faz o select , passando os valores
3º faz o executeUpdate();

Acho que assim fica mais organizado e fácil de visualizar…

abraco

Valeu, Pessoal… consegui da forma q o rodrigo_gomes me passou.

obrigado

Boa Tarde a todos, primeiramente quero pedir desculpas se estou duplicando o topico pois estou desde de ontem, proucurando uma uma referencia para resolver minha dificuldade e não consegui.
Bom estou querendo ao clicar no botão gravar inserir as informações no banco de dados (Mysq 5.0). A conexão está tudo ok. Agradeço a paciencia de todos Ótimo 2009
classe ConexaoMysql.java

import java.sql.Connection;    
import java.sql.DriverManager;    
import java.sql.ResultSet;    
import java.sql.SQLException;    
import java.sql.Statement;    
import javax.print.attribute.standard.JobMessageFromOperator;  
import javax.swing.JOptionPane;    
    
    
public class ConexaoMySql {    
  
   public static Connection conexao;  
   public static Statement stm;  
  
     public void conectar()  
   {  
        try {  
            if (conexao == null) {  
                Class.forName("com.mysql.jdbc.Driver"); //carrega os drivers do mysql na memoria  
                conexao = DriverManager.getConnection("jdbc:mysql://localhost:3306/cliente?user=root&password=root"); //estabelece a conexao  
                JOptionPane.showMessageDialog(null,"Conectado!!");  
            }  
        } catch (Exception e) {//Em caso de erro ele entra nessa parte!!!  
            e.printStackTrace();  
        }  
    }  
   public void executarSql(String sql)  
   {  
        try {  
            conectar();  
            Statement stmt = conexao.createStatement();  
            stmt.executeUpdate(sql);  
            System.out.println("SQL EXECUTADA: " + sql);  
            stmt.close();  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
    }  
     
}  

Classe Cadastro
view plainprint?
import javax.sound.midi.ShortMessage;
import javax.swing.JOptionPane;

/*

  • Cadastro.java
public class Cadastro extends javax.swing.JFrame {  
    ConexaoMySql conecta;   //criando um objeto da classe ConexaoMySql  
    
    /** Creates new form Cadastro */  
    public Cadastro() {  
        initComponents();  
        conecta = new ConexaoMySql();    //inicializando o objeto   
        conecta.conectar();  
          
          
         
    }  
    /** 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. 
     */  
    // <editor-fold defaultstate="collapsed" desc=" Código Gerado ">                            
    private void initComponents() {  
        jLabel1 = new javax.swing.JLabel();  
        jLabel2 = new javax.swing.JLabel();  
        jLabel3 = new javax.swing.JLabel();  
        jLabel4 = new javax.swing.JLabel();  
        jLabel5 = new javax.swing.JLabel();  
        jLabel6 = new javax.swing.JLabel();  
        nomeTF = new javax.swing.JTextField();  
        nickTF = new javax.swing.JTextField();  
        endTF = new javax.swing.JTextField();  
        numlTF = new javax.swing.JTextField();  
        telTF = new javax.swing.JTextField();  
        celTF = new javax.swing.JTextField();  
        jButton1 = new javax.swing.JButton();  
        jLabel7 = new javax.swing.JLabel();  
  
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);  
        setBackground(new java.awt.Color(0, 255, 255));  
        jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12));  
        jLabel1.setText("Nome");  
  
        jLabel2.setFont(new java.awt.Font("SansSerif", 1, 12));  
        jLabel2.setText("Nick");  
  
        jLabel3.setFont(new java.awt.Font("SansSerif", 1, 12));  
        jLabel3.setText("End");  
  
        jLabel4.setFont(new java.awt.Font("SansSerif", 1, 12));  
        jLabel4.setText("Numero");  
  
        jLabel5.setFont(new java.awt.Font("SansSerif", 1, 12));  
        jLabel5.setText("Telefone");  
  
        jLabel6.setFont(new java.awt.Font("SansSerif", 1, 12));  
        jLabel6.setText("Celular");  
  
        nomeTF.addActionListener(new java.awt.event.ActionListener() {  
            public void actionPerformed(java.awt.event.ActionEvent evt) {  
                nomeTFActionPerformed(evt);  
            }  
        });  
  
        nickTF.addActionListener(new java.awt.event.ActionListener() {  
            public void actionPerformed(java.awt.event.ActionEvent evt) {  
                nickTFActionPerformed(evt);  
            }  
        });  
  
        jButton1.setText("GRAVAR");  
        jButton1.addActionListener(new java.awt.event.ActionListener() {  
            public void actionPerformed(java.awt.event.ActionEvent evt) {  
                jButton1ActionPerformed(evt);  
            }  
        });  
  
        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 36));  
        jLabel7.setText("CADASTRO DE CLIENTES");  
  
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());  
        getContentPane().setLayout(layout);  
        layout.setHorizontalGroup(  
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()  
                .addContainerGap(72, Short.MAX_VALUE)  
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)  
                .addContainerGap())  
            .addGroup(layout.createSequentialGroup()  
                .addGap(46, 46, 46)  
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)  
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)  
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)  
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)  
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))  
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)  
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                    .addGroup(layout.createSequentialGroup()  
                        .addComponent(jButton1)  
                        .addContainerGap())  
                    .addGroup(layout.createSequentialGroup()  
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                            .addComponent(nomeTF, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)  
                            .addComponent(nickTF, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)  
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()  
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)  
                                    .addGroup(layout.createSequentialGroup()  
                                        .addComponent(telTF, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)  
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)  
                                        .addComponent(jLabel6))  
                                    .addComponent(endTF, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))  
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)  
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                                    .addComponent(celTF, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)  
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()  
                                        .addComponent(jLabel4)  
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)  
                                        .addComponent(numlTF, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)))))  
                        .addGap(72, 72, 72))))  
        );  
  
        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {celTF, telTF});  
  
        layout.setVerticalGroup(  
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
            .addGroup(layout.createSequentialGroup()  
                .addContainerGap()  
                .addComponent(jLabel7)  
                .addGap(21, 21, 21)  
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)  
                    .addComponent(nomeTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)  
                    .addComponent(jLabel1))  
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                    .addGroup(layout.createSequentialGroup()  
                        .addGap(8, 8, 8)  
                        .addComponent(jLabel2))  
                    .addGroup(layout.createSequentialGroup()  
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)  
                        .addComponent(nickTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))  
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)  
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)  
                    .addComponent(jLabel3)  
                    .addComponent(numlTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)  
                    .addComponent(jLabel4)  
                    .addComponent(endTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))  
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)  
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)  
                    .addComponent(jLabel5)  
                    .addComponent(celTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)  
                    .addComponent(telTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)  
                    .addComponent(jLabel6))  
                .addGap(28, 28, 28)  
                .addComponent(jButton1)  
                .addContainerGap(39, Short.MAX_VALUE))  
        );  
        pack();  
    }// </editor-fold>                          
  
    private void nickTFActionPerformed(java.awt.event.ActionEvent evt) {                                         
// TODO adicione seu código de manipulação aqui:  
    }                                        
  
    private void nomeTFActionPerformed(java.awt.event.ActionEvent evt) {                                         
// TODO adicione seu código de manipulação aqui:  
    }                                        
  
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
  
    }                                          
      
    /** 
     * @param args the command line arguments 
     */  
    public static void main(String args[]) {  
        java.awt.EventQueue.invokeLater(new Runnable() {  
            public void run() {  
                new Cadastro().setVisible(true);  
            }  
        });  
    }  
      
    // Declaração de variáveis - não modifique                       
    private javax.swing.JTextField celTF;  
    private javax.swing.JTextField endTF;  
    private javax.swing.JButton jButton1;  
    private javax.swing.JLabel jLabel1;  
    private javax.swing.JLabel jLabel2;  
    private javax.swing.JLabel jLabel3;  
    private javax.swing.JLabel jLabel4;  
    private javax.swing.JLabel jLabel5;  
    private javax.swing.JLabel jLabel6;  
    private javax.swing.JLabel jLabel7;  
    private javax.swing.JTextField nickTF;  
    private javax.swing.JTextField nomeTF;  
    private javax.swing.JTextField numlTF;  
    private javax.swing.JTextField telTF;  
    // Fim da declaração de variáveis                     
      }  

Bom dia a todos minha duvbida ocorre entre a linha 177 e 185, já consegui acimilar DAO e PreparedStatement, porém, acho que o grande problema é a pratica, se alguem poder me dá um dica se estou implementando o botão gravar corretamente ficarei muito grato. feliz 2009 a todos

classe conexao

[code]
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.print.attribute.standard.JobMessageFromOperator;
import javax.swing.JOptionPane;

public class ConexaoMySql {

public static Connection conexao;
public static Statement stm;

  public void conectar()

{
try {
if (conexao == null) {
Class.forName(“com.mysql.jdbc.Driver”); //carrega os drivers do mysql na memoria
conexao = DriverManager.getConnection(“jdbc:mysql://localhost:3306/cliente?user=root&password=root”); //estabelece a conexao
JOptionPane.showMessageDialog(null,“Conectado!!”);
}
} catch (Exception e) {//Em caso de erro ele entra nessa parte!!!
e.printStackTrace();
}
}
public void executarSql(String nomeTF, String nickTF, String endTF, String numTF, String telTF,String celTF)
{
try {
conectar();
PreparedStatement pstmt = conexao.prepareStatement(
“insert into cliente values(?, ?, ?,?,?)”);
pstmt.setString(1,nomeTF);
pstmt.setString(2,nickTF);
pstmt.setString(3,endTF);
pstmt.setInt(4, Integer.parseInt(numTF) );
pstmt.setInt(5, Integer.parseInt(telTF) );
pstmt.setInt(6, Integer.parseInt(celTF) );
pstmt.executeUpdate();
System.out.println(pstmt);
pstmt.close();
conexao.close();
} catch (Exception e) {
e.printStackTrace();
}

}
}[/code]

classe clientes

import com.mysql.jdbc.PreparedStatement;
import javax.sound.midi.ShortMessage;
import javax.swing.JOptionPane;

/*
 * Cadastro.java
 *
 * Created on 23 de Dezembro de 2008, 23:18
 */

/**
 *
 * @author  Administrador
 */
public class Cadastro extends javax.swing.JFrame {
    ConexaoMySql conecta;   //criando um objeto da classe ConexaoMySql
    
    /** Creates new form Cadastro */
    public Cadastro() {
        initComponents();
        conecta = new ConexaoMySql();    //inicializando o objeto 
        conecta.conectar();
           
        
       
    }
    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc=" Código Gerado ">                          
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        nomeTF = new javax.swing.JTextField();
        nickTF = new javax.swing.JTextField();
        endTF = new javax.swing.JTextField();
        numlTF = new javax.swing.JTextField();
        telTF = new javax.swing.JTextField();
        celTF = new javax.swing.JTextField();
        insert = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(0, 255, 255));
        jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12));
        jLabel1.setText("Nome");

        jLabel2.setFont(new java.awt.Font("SansSerif", 1, 12));
        jLabel2.setText("Nick");

        jLabel3.setFont(new java.awt.Font("SansSerif", 1, 12));
        jLabel3.setText("End");

        jLabel4.setFont(new java.awt.Font("SansSerif", 1, 12));
        jLabel4.setText("Numero");

        jLabel5.setFont(new java.awt.Font("SansSerif", 1, 12));
        jLabel5.setText("Telefone");

        jLabel6.setFont(new java.awt.Font("SansSerif", 1, 12));
        jLabel6.setText("Celular");

        nomeTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nomeTFActionPerformed(evt);
            }
        });

        nickTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nickTFActionPerformed(evt);
            }
        });

        insert.setText("GRAVAR");
        insert.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                insertActionPerformed(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 36));
        jLabel7.setText("CADASTRO DE CLIENTES");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(72, Short.MAX_VALUE)
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(insert)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nomeTF, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
                            .addComponent(nickTF, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(telTF, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel6))
                                    .addComponent(endTF, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(celTF, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(jLabel4)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(numlTF, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addGap(72, 72, 72))))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {celTF, telTF});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel2))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nickTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(numlTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(endTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(celTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(telTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(28, 28, 28)
                .addComponent(insert)
                .addContainerGap(39, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>                        

    private void nickTFActionPerformed(java.awt.event.ActionEvent evt) {                                       
// TODO adicione seu código de manipulação aqui:
    }                                      

    private void nomeTFActionPerformed(java.awt.event.ActionEvent evt) {                                       
// TODO adicione seu código de manipulação aqui:
    }                                      

    private void insertActionPerformed(java.awt.event.ActionEvent evt, boolean executarSQL) {                                       
         conectar();
         executarSQL(nomeTF.getText(), nickTF.getText(),endTF.getText(),numTF.getText(), telTF.getText, celTF.getText()); //duvida
if  (executarSQL  == true){
      JOptionPane.showMessageDialog(null, "gravada"); 
}else 
JOptionPane.showMessageDialog(null, "Não foi possível efetuar a gravação"); 
   
    }                                      
         
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Cadastro().setVisible(true);
            }
        });
    }

    private void conectar() {
        throw new UnsupportedOperationException("Not yet implemented");
    }
    
    // Declaração de variáveis - não modifique                     
    private javax.swing.JTextField celTF;
    private javax.swing.JTextField endTF;
    private javax.swing.JButton insert;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JTextField nickTF;
    private javax.swing.JTextField nomeTF;
    private javax.swing.JTextField numlTF;
    private javax.swing.JTextField telTF;
    // Fim da declaração de variáveis                   
    
}