Passando informações entre Frames [RESOLVIDO]

Olá pessoal!!!
Sou novata em Java e aqui também!
Estou precisando de uma ajudinha, na minha opinião não é dificil, mas não estou conseguindo.
Seguinte, tenho um JFrame (CadProd) onde o usuario irá cadastrar os produtos. Quando ele quiser alterar um produto é chamado um outro JFrame (ConsProdt) onde ele encontra o produto desejado (este formulario busca no banco ele navega atraves dos botões próximo, anterior…)e ao clicar em OK este form de consulta deve ser fechado e o produto escolhido deve ir para os JTextFields do Form de cadastro. Isto tudo estava funcionando até ontem a noite, mas por algum motivo misterioso e desconhecido parou!
Ja tentei passar a classe cadastro pelo construtor para a classe de consulta, mas nada esta dando certo. O que esta acontecendo neste momento é que quando eu chamo a classe consulta ele ja atribui na minha classe cadastro o primeiro registro do banco, e mesmo depois de navegar na consulta e clicar em Ok, ele ignora o registro escolhido.
Abaixo segue os trechos citados do código.
Se vocês puderem me ajudar, ficarei imensamente grata, pois este é o projeto do meu TCC, e é para segunda feira!!!

//codigo do botão que chama a tela de consulta
private void bConsultaActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        ConsProdt cProduto = new ConsProdt();
        cProduto.setVisible(true);
        
        tCodProd.setText(cProduto.getCodProd());
        tDescricao.setText(cProduto.getDescricao());
        tPrecoVenda.setText(cProduto.getPrecoVenda());
//Esse é código que inicia a classe consulta
public class ConsProdt extends javax.swing.JFrame {
    Conexao conCons;
    /** Creates new form ConsProdt */
    public ConsProdt() {
        initComponents();

        conCons = new Conexao();
        conCons.conecta();
        conCons.executeSql("SELECT * FROM produto");
        try{
            conCons.rs.first();
            MostraProdt();

        }catch(Exception e){
            System.out.print(e);
        }


    }
//get dos campos da classe consulta.
    public String getCodProd(){
        return tCodProd.getText();
    }
    public String getDescricao(){
        return tDescricao.getText();
    }
    public String getPrecoVenda(){
        return tPrecoVenda.getText();
    }
    public String getBloqueado(){
        return cbBloqueado.getSelectedItem().toString();
    }

Gente postei as partes que achei que fossem importante, caso queiram tudo, tudo me avisem que mando bala!!
Agradeço muitissimo!!!

pode mandar todo o codigo por PM(mensagem privada)?Acho que posso ajudar

Oi Thiago!
Acabei de te mandar!
Demorei um pouco pq este pc em que estou esta super lento, e até que achar o tópico que tinha criado e ver q ja tinha resposta levou um tempinho!rsrs
Mas agora ja mandei!
Obrigada
Fernanda

Se mais alguem quiser ver o código é só me dizer que mando (inclusive aqui mesmo). Estou muito precisando de ajuda!!
Obrigada

Não sei porque exatamente do PM mas sim, passar o código inteiro permite que qualquer usuário possa se dispor a ajudar …
Vou dar uma lida no que foi passado e se conseguir responder eu edito esse post, mas como estou vendo que você está on no momento, se der tempo seria mais prático ter o resto do código postado.

Oii!
Ok, segue o código todo, das duas classes!

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadProd.java
 *
 * Created on 27/06/2009, 18:16:50
 */

package svpGui;

//import java.util.logging.Level;
//import java.util.logging.Logger;
import javax.swing.*;
import svpCodigo.ConectaProdt;
import svpCodigo.Conexao;
import svpCodigo.Consulta;



/**
 *
 * @author Meninas
 */
public class CadProd extends javax.swing.JFrame {

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

        jlTitulo = new javax.swing.JLabel();
        jlDescricao = new javax.swing.JLabel();
        tDescricao = new javax.swing.JTextField();
        jlPrecoVenda = new javax.swing.JLabel();
        tPrecoVenda = new javax.swing.JTextField();
        jlBloqueado = new javax.swing.JLabel();
        cbBloqueado = new javax.swing.JComboBox();
        bSalvar = new javax.swing.JButton();
        bCancelar = new javax.swing.JButton();
        bSair = new javax.swing.JButton();
        bAjuda = new javax.swing.JButton();
        bAlterar = new javax.swing.JButton();
        jlCodProd = new javax.swing.JLabel();
        tCodProd = new javax.swing.JTextField();
        bConsulta = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Cadastro de Produtos");

        jlTitulo.setFont(new java.awt.Font("Tahoma", 1, 36));
        jlTitulo.setText("Cadastro de Produtos");

        jlDescricao.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlDescricao.setText("Descrição");

        tDescricao.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        tDescricao.setName("tDescricao"); // NOI18N

        jlPrecoVenda.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlPrecoVenda.setText("Preço de Venda - R$");

        tPrecoVenda.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        tPrecoVenda.setToolTipText("Utilize o ponto para separar valores Ex: 1.00");
        tPrecoVenda.setName("tPrecoVenda"); // NOI18N

        jlBloqueado.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlBloqueado.setText("Bloqueado");

        cbBloqueado.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        cbBloqueado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sim", "Não" }));
        cbBloqueado.setToolTipText("Informe se o produto esta bloqueado para venda");
        cbBloqueado.setName("cbBloqueado"); // NOI18N

        bSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/Save.gif"))); // NOI18N
        bSalvar.setText("Salvar");
        bSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bSalvarActionPerformed(evt);
            }
        });

        bCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/Delete.gif"))); // NOI18N
        bCancelar.setText("Cancelar");

        bSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/Exit.gif"))); // NOI18N
        bSair.setText("Sair");
        bSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bSairActionPerformed(evt);
            }
        });

        bAjuda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20png/Bulb.png"))); // NOI18N
        bAjuda.setText("Ajuda");

        bAlterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/DocumentDraw.gif"))); // NOI18N
        bAlterar.setText("Alterar");

        jlCodProd.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlCodProd.setText("Código");

        tCodProd.setEditable(false);
        tCodProd.setFont(new java.awt.Font("Tahoma", 0, 14));

        bConsulta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/16x16/Binocular.gif"))); // NOI18N
        bConsulta.setToolTipText("Clique para selecionar um produto ja cadastrado");
        bConsulta.setName("bConsulta"); // NOI18N
        bConsulta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bConsultaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(bAlterar)
                .addGap(50, 50, 50)
                .addComponent(bSalvar)
                .addGap(47, 47, 47)
                .addComponent(bCancelar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
                .addComponent(bAjuda)
                .addGap(46, 46, 46)
                .addComponent(bSair)
                .addGap(30, 30, 30))
            .addGroup(layout.createSequentialGroup()
                .addGap(80, 80, 80)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jlDescricao))
                            .addComponent(jlCodProd))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jlTitulo)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(tCodProd, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(bConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jlPrecoVenda)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tPrecoVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(51, 51, 51)
                        .addComponent(jlBloqueado)
                        .addGap(18, 18, 18)
                        .addComponent(cbBloqueado, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(88, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addComponent(jlTitulo)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(67, 67, 67)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jlCodProd)
                            .addComponent(tCodProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(45, 45, 45))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(bConsulta)
                        .addGap(44, 44, 44)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlDescricao))
                .addGap(42, 42, 42)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlPrecoVenda)
                    .addComponent(tPrecoVenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlBloqueado)
                    .addComponent(cbBloqueado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bAlterar)
                    .addComponent(bSalvar)
                    .addComponent(bCancelar)
                    .addComponent(bAjuda)
                    .addComponent(bSair))
                .addGap(38, 38, 38))
        );

        pack();
    }// </editor-fold>                        

    private void bSairActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        //Conexao fecha  = new Conexao();
        //fecha.desconeta();
        CadProd.this.dispose();
        
    }                                     

    private void bSalvarActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        //String bloqueioP;
        float valor;
        
        valor = Float.parseFloat(tPrecoVenda.getText());
        if (valor < 0){JOptionPane.showMessageDialog(null, "Digite um preço maior que zero");}
        else{
        if (tDescricao.getText().equals("")||tPrecoVenda.getText().equals("")){
            JOptionPane.showMessageDialog(null, "Preencha todos os campos obrigatorios");
        }
        else {

            ConectaProdt conPt = new ConectaProdt(tDescricao, tPrecoVenda, cbBloqueado);
            JOptionPane.showMessageDialog(null, "Produto cadastrado com sucesso");
            tDescricao.setText("");
            tPrecoVenda.setText("");
            tDescricao.requestFocus();
        }
        }
        
    }                                       

    private void bConsultaActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        ConsProdt cProduto = new ConsProdt();
        cProduto.setVisible(true);
        
        tCodProd.setText(cProduto.getCodProd());
        tDescricao.setText(cProduto.getDescricao());
        tPrecoVenda.setText(cProduto.getPrecoVenda());
        //cbBloqueado.getSelectedIndex(cProduto.getBloqueado());
        
    }                                         

    public void Atualiza(JTextField cod, JTextField desc, JTextField preco, JComboBox bloq ){
        String cod1 = cod.getText();
        String desc1 = desc.getText();
        String preco1 = preco.getText();
        //int bloq1 = bloq.setSelectedIndex();
        tCodProd.setText("cod1");
        tDescricao.setText("desc1");
        tPrecoVenda.setText("preco1");
        //cbBloqueado.setSelectedItem(bloq);
        
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CadProd().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton bAjuda;
    private javax.swing.JButton bAlterar;
    private javax.swing.JButton bCancelar;
    private javax.swing.JButton bConsulta;
    private javax.swing.JButton bSair;
    private javax.swing.JButton bSalvar;
    private javax.swing.JComboBox cbBloqueado;
    private javax.swing.JLabel jlBloqueado;
    private javax.swing.JLabel jlCodProd;
    private javax.swing.JLabel jlDescricao;
    private javax.swing.JLabel jlPrecoVenda;
    private javax.swing.JLabel jlTitulo;
    private javax.swing.JTextField tCodProd;
    private javax.swing.JTextField tDescricao;
    private javax.swing.JTextField tPrecoVenda;
    // End of variables declaration                   

}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConsProdt.java
 *
 * Created on 14/11/2009, 16:16:03
 */

package svpGui;

import java.sql.SQLException;
import javax.swing.JOptionPane;
import svpCodigo.Conexao;

/**
 *
 * @author fernanda
 */

public class ConsProdt extends javax.swing.JFrame {
    Conexao conCons;
    /** Creates new form ConsProdt */
    public ConsProdt() {
        initComponents();

        conCons = new Conexao();
        conCons.conecta();
        conCons.executeSql("SELECT * FROM produto");
        try{
            conCons.rs.first();
            MostraProdt();

        }catch(Exception e){
            System.out.print(e);
        }


    }

    

    /** 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() {

        jlTitulo = new javax.swing.JLabel();
        jlCodProd = new javax.swing.JLabel();
        tCodProd = new javax.swing.JTextField();
        jlDescricao = new javax.swing.JLabel();
        tDescricao = new javax.swing.JTextField();
        jlPrecoVenda = new javax.swing.JLabel();
        tPrecoVenda = new javax.swing.JTextField();
        jlBloqueado = new javax.swing.JLabel();
        cbBloqueado = new javax.swing.JComboBox();
        bProximo = new javax.swing.JButton();
        bSair = new javax.swing.JButton();
        bPrimeiro = new javax.swing.JButton();
        bAnterior = new javax.swing.JButton();
        bPesquisar = new javax.swing.JButton();
        bUltimo = new javax.swing.JButton();
        tPesquisa = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        bOK = new javax.swing.JButton();
        bAjuda = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Consulta de Produtos");

        jlTitulo.setFont(new java.awt.Font("Tahoma", 1, 36));
        jlTitulo.setText("Consulta de Produtos");

        jlCodProd.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlCodProd.setText("Código");

        tCodProd.setFont(new java.awt.Font("Tahoma", 0, 14));

        jlDescricao.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlDescricao.setText("Descrição");

        tDescricao.setFont(new java.awt.Font("Tahoma", 0, 14));
        tDescricao.setName("tDescricao"); // NOI18N

        jlPrecoVenda.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlPrecoVenda.setText("Preço de Venda - R$");

        tPrecoVenda.setFont(new java.awt.Font("Tahoma", 0, 14));
        tPrecoVenda.setToolTipText("Utilize o ponto para separar valores Ex: 1.00");
        tPrecoVenda.setName("tPrecoVenda"); // NOI18N

        jlBloqueado.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlBloqueado.setText("Bloqueado");

        cbBloqueado.setFont(new java.awt.Font("Tahoma", 0, 14));
        cbBloqueado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sim", "Não" }));
        cbBloqueado.setToolTipText("Informe se o produto esta bloqueado para venda");
        cbBloqueado.setName("cbBloqueado"); // NOI18N

        bProximo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/VCRForward.gif"))); // NOI18N
        bProximo.setText("Próximo");
        bProximo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bProximoActionPerformed(evt);
            }
        });

        bSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/Exit.gif"))); // NOI18N
        bSair.setText("Sair");
        bSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bSairActionPerformed(evt);
            }
        });

        bPrimeiro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/VCRBegin.gif"))); // NOI18N
        bPrimeiro.setText("Primeiro");
        bPrimeiro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bPrimeiroActionPerformed(evt);
            }
        });

        bAnterior.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/VCRBack.gif"))); // NOI18N
        bAnterior.setText("Anterior");
        bAnterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bAnteriorActionPerformed(evt);
            }
        });

        bPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/BlueCircle.gif"))); // NOI18N
        bPesquisar.setText("Pesquisar");
        bPesquisar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bPesquisarActionPerformed(evt);
            }
        });

        bUltimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/VCREnd.gif"))); // NOI18N
        bUltimo.setText("Último");
        bUltimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bUltimoActionPerformed(evt);
            }
        });

        tPesquisa.setFont(new java.awt.Font("Tahoma", 0, 14));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setText("Pesquisar por Descrição");

        bOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20/Check.gif"))); // NOI18N
        bOK.setText("OK");
        bOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bOKActionPerformed(evt);
            }
        });

        bAjuda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/javalobby/icons/20x20png/Bulb.png"))); // NOI18N
        bAjuda.setText("Ajuda");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(tPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(bPesquisar))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jlDescricao)
                                .addComponent(jlCodProd))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(tDescricao, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
                                .addComponent(tCodProd, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(bPrimeiro)
                                .addGap(14, 14, 14)
                                .addComponent(bAnterior)
                                .addGap(18, 18, 18)
                                .addComponent(bProximo)
                                .addGap(10, 10, 10)
                                .addComponent(bUltimo))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jlPrecoVenda)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(tPrecoVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(51, 51, 51)
                                .addComponent(jlBloqueado)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(cbBloqueado, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(104, 104, 104)
                        .addComponent(jlTitulo)))
                .addGap(108, 108, 108))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(195, Short.MAX_VALUE)
                .addComponent(bOK)
                .addGap(36, 36, 36)
                .addComponent(bAjuda)
                .addGap(18, 18, 18)
                .addComponent(bSair)
                .addGap(238, 238, 238))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlTitulo)
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(tPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bPesquisar))
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tCodProd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlCodProd))
                .addGap(45, 45, 45)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlDescricao))
                .addGap(42, 42, 42)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlPrecoVenda)
                    .addComponent(tPrecoVenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlBloqueado)
                    .addComponent(cbBloqueado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bPrimeiro)
                    .addComponent(bUltimo)
                    .addComponent(bAnterior)
                    .addComponent(bProximo))
                .addGap(36, 36, 36)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bSair)
                    .addComponent(bOK)
                    .addComponent(bAjuda))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>                        

    private void bProximoActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        //conCons = new Conexao();
        //conCons.conecta();
        //conCons.executeSql("SELECT * FROM produto");
        try{
            conCons.rs.next();
            MostraProdt();
            if (! conCons.rs.next()){JOptionPane.showMessageDialog(null, "Não há mais registros");}

        }catch(Exception e){
            System.out.print(e);
        }
    }                                        

    private void bSairActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        ConsProdt.this.dispose();
    }                                     

    private void bPrimeiroActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        conCons = new Conexao();
        conCons.conecta();
        conCons.executeSql("SELECT * FROM produto");
        try{
            conCons.rs.first();
            MostraProdt();
        }catch(Exception e){
            System.out.print(e);
        }
    }                                         

    private void bAnteriorActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        conCons = new Conexao();
        conCons.conecta();
        conCons.executeSql("SELECT * FROM produto");
        try{
            conCons.rs.previous();
            MostraProdt();

        }catch(SQLException e){
            System.out.print(e);
        }
    }                                         

    private void bPesquisarActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        try{
            conCons.rs.first();
            String igual = "n";
            int tamPesq = tPesquisa.getText().length();
            while (igual == "n"){
                String pesquisado = conCons.rs.getString("descricao").substring(0, (tamPesq));

                if (pesquisado.equals(tPesquisa.getText())){
                    igual = "s";
                }else conCons.rs.next();
            }
            MostraProdt();
            
        }catch(Exception e){
            System.out.print(e);
        }
        
    }                                          

    private void bUltimoActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        conCons = new Conexao();
        conCons.conecta();
        conCons.executeSql("SELECT * FROM produto");
        try{
            conCons.rs.last();
            MostraProdt();

        }catch(Exception e){
            System.out.print("Não foi possivel localizar o ultimo registro" +e);
        }
    }                                       

    private void bOKActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        //CadProd mostra = new CadProd();
        //mostra.Atualiza(tCodProd, tDescricao, tPrecoVenda, cbBloqueado);
        ConsProdt.this.dispose();
        return;

    }                                   

    public void MostraProdt(){
        
        try{
            tCodProd.setText(conCons.rs.getString("codigo"));
            tPrecoVenda.setText(conCons.rs.getString("preco"));
            cbBloqueado.setSelectedItem(conCons.rs.getString("bloqueado"));
            tDescricao.setText(conCons.rs.getString("descricao"));

        }catch(Exception e){
            System.out.print(e);
        }
    }

    public String getCodProd(){
        return tCodProd.getText();
    }
    public String getDescricao(){
        return tDescricao.getText();
    }
    public String getPrecoVenda(){
        return tPrecoVenda.getText();
    }
    public String getBloqueado(){
        return cbBloqueado.getSelectedItem().toString();
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ConsProdt().setVisible(true);



            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton bAjuda;
    private javax.swing.JButton bAnterior;
    private javax.swing.JButton bOK;
    private javax.swing.JButton bPesquisar;
    private javax.swing.JButton bPrimeiro;
    private javax.swing.JButton bProximo;
    private javax.swing.JButton bSair;
    private javax.swing.JButton bUltimo;
    private javax.swing.JComboBox cbBloqueado;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jlBloqueado;
    private javax.swing.JLabel jlCodProd;
    private javax.swing.JLabel jlDescricao;
    private javax.swing.JLabel jlPrecoVenda;
    private javax.swing.JLabel jlTitulo;
    private javax.swing.JTextField tCodProd;
    private javax.swing.JTextField tDescricao;
    private javax.swing.JTextField tPesquisa;
    private javax.swing.JTextField tPrecoVenda;
    // End of variables declaration                   


}

Obrigada!!

Por enquanto … o erro não apareceu misteriosamente depois que você comentou essas 2 linhas no actionPerformed do OKButton ?
//CadProd mostra = new CadProd();
//mostra.Atualiza(tCodProd, tDescricao, tPrecoVenda, cbBloqueado);

Nãoo, essas linhas eu comentei porque estava chamando este método recebendo os texts, mas depois criei os get´s para os texts da classe consulta e dai na classe cadastro consegui pegar sem utilizar o método atualiza, dai deixei comentado.
Ate tentei tira-los agora, fazer um novo teste, mas continua igual, sempre pegando o primeiro regitro, tipo abre o form cadastro mas não “para” nesta linha para esperar que seja escolhido, ele prossegue e ja preenche os texts

Antes, ou como deve funcionar é mais ou menos assim:

private void bConsultaActionPerformed(java.awt.event.ActionEvent evt) {                                             
        // TODO add your handling code here:   
        ConsProdt cProduto = new ConsProdt();   
        cProduto.setVisible(true);   

faz até aqui, abrindo o form consulta para que seja escolhido o produto, e depois disso faz o restante:

           
        tCodProd.setText(cProduto.getCodProd());   
        tDescricao.setText(cProduto.getDescricao());   
        tPrecoVenda.setText(cProduto.getPrecoVenda());   
        //cbBloqueado.getSelectedIndex(cProduto.getBloqueado());   
           
    }                                           

Talvez o que eu esteja fazendo esta errado, ele não “para para esperar” mas é mais ou menos isso que preciso
:frowning:

Olha só as telas!
Quando eu clico no botão com a lupa da tela de cadastro ele chama a de consulta mas ja preenche a de cadastro!O que esta errado.
Dai eu seleciono o produto “estojo” na tela de consulta e quando clico em ok o estojo e suas informações deveria aparecer na tela de cadastro, mas não vai!


Sobre já preencher os dados deve ser por causa disso:

[code]private void bConsultaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
ConsProdt cProduto = new ConsProdt();
cProduto.setVisible(true);

    tCodProd.setText(cProduto.getCodProd());  
    tDescricao.setText(cProduto.getDescricao());  
    tPrecoVenda.setText(cProduto.getPrecoVenda());  
    //cbBloqueado.getSelectedIndex(cProduto.getBloqueado());  
      
}[/code]

Logo após você criar o cProduto (que deve abrir a janela de consulta), você está preenchendo os valores de tCodProd, tDescricao e tPrecoVenda sem nem mesmo mexer na tela de consulta.
Isso está preenchendo a tela de cadastro com os dados que são preenchidos inicialmente quando você cria a tela cProduto e chama as seguintes instruções.

conCons.executeSql("SELECT * FROM produto"); try{ conCons.rs.first(); MostraProdt();

Ou seja, para parar de exibir esses dados quando a tela de consulta for criada o mais adequado seria retirar as chamadas setText de tCodProd, tDescricao e tPrecoVenda.
O certo seria você programar para que somente quando o actionPerformed do botão “OK” da consulta fosse acionado, a janela de cadastro faria essas chamadas de setText

Oi!
Então, era mais ou menos isso que tentei fazer com o método atualiza, que esta comentado ( que você ja havia citado acima) dai ele realmente não carrega com as informações de primeira, mas tb nao atualiza os campos, tentei colocar um update na tela, mas não deu certo, tipo não consigo usar o método update, mas não consegui encontrar algo que faça isso.

Como não tenho netbeans e não sei como fazer funcionar esse GroupLayout fora dele então tem que ser devagar assim =/
Primeiramente no código comentado:
//CadProd mostra = new CadProd();
//mostra.Atualiza(tCodProd, tDescricao, tPrecoVenda, cbBloqueado);

Este “mostra” é uma referência a uma janela de cadastro mas como você está criando outra, não será a mesma que chamou a janela de busca. Você precisa dar um jeito de trocar essa referência pela mesma janela que criou a janela de busca com “ConsProdt cProduto = new ConsProdt();”

Segundo o seu método “Atualiza” só precisa das informações, e não dos componentes. Ao invés de receber os JTextField como parâmetro, coloque o método para receber Strings e use as chamadas getText quando for chamar o Atualiza.

Por último (por enquanto pelo menos):
Seu método atualiza está assim:
tCodProd.setText(“cod1”);
tDescricao.setText(“desc1”);
tPrecoVenda.setText(“preco1”);

Dessa forma, sempre que ele for chamado ele vai configurar o texto desses 3 componentes com essas 3 frases que você setou “cod1”, “desc1” e “preco1”. Sua intenção nessa hora deveria ser escrever o conteúdo das variáveis de mesmo nome. Para isso bastaria tirar os colchetes “”.

Consegui!!
Conseguimos!!
Bom fiquei tentando uma maneira de não dar “new” e não encontrei, rsrs, mas consegue fazendo assim:
No momento que chamo o formulario de consulta, desabilitei a visibilidade o formulario de cadastro, e no botão OK da consulta quando instancio um novo cadastro eu deixei visible de novo.
Não sei como isso vai ficar na mémoria da maquina, mas para a apresentação do TCC acho que vai ficar assim mesmo!
Muito Obrigada!!

Na verdade mesmo, eu consegui parcialmente!
Por que tem tela em que o usuario ja vai ter digitado alguams informações e eu não posso criar outra e ignorar a primeira, então eu conseguisse outra alternativa seria ótimo.
Ainda não vou colocar Resolvido no titulo, pois podem haver mais mensagens né!
Obrigada e boa noite!

Bom, encontrei duas soluções para este problema:

  1. No momento em que chamo o form de consulta fecho minha instancia do cadastro. Ex:
    ConsProdt cProd = new ConsProdt();
    cProd.setVisible(true);
    CadProd.this.dispose();

E depois no botão Ok da Consulta, eu crio a instancia de Cadastro e mando ficar visivel. Ex:

     CadProd caProd = new CadProd();
     caProd.Atualiza(tCodProd, tDescricao, tPrecoVenda, cbBloqueado);
     caProd.setVisible(true);

Deste jeito tinha funcionado, mas fechava a 1ª instancia, então em uma tela que o usuario ja tivesse digitado algo isso seria perdido.
Então, consegui de uma outra maneira.

  1. Na classe de Consulta, declarei a classe Cadastro como framePai, e o passei no construtor da Consulta.
private CadProd framePai;
    
    public ConsProdt(CadProd framePai) {
        this.framePai = framePai;
        initComponents();

No botão Ok, onde o produto escolhido irá “voltar” para o formulario de Cadastro chamo o método da minha instacia aberta:

private void bOKActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        
        framePai.Atualiza(tCodProd, tDescricao, tPrecoVenda, cbBloqueado);
        ConsProdt.this.dispose();
    }  

Desta segunda maneira, tive que criar mais tela de consulta, pois ela esta recendo com objeto quem a instaciou, mas eu tenho outra tela que também a instancia, então dupliquei meu form consulta e mudei o frame pai. Como o meu projeto é pequeno, meu problema foi resolvido.
Esta segunda solução consegui em um outro tópico aqui do grupo mesmo. Depois de trocar mensagens com o CrOnNoS e receber ajuda para meu problema, dei uma olhada se poderia ajudar alguem e encontrei um tópico que tinha essas instruções e serviram para mim!
Muito obrigada!