Pegar entrada no JText Field com botão e mostrar no JTextArea no mesmo JPanel

Olá pessoal, blz?

Estou batendo kbeça com o desenvolvimento de um protótipo de WebService cliente utilizando Swing.
O cenário é o seguinte: implementei um protótipo de webservice em java que faz consulta e compra de produtos.
No cliente estou utilizando a API do JAVA SWING. Em certa parte do Sistema o cliente acessa na tela principal o menu compra e ele é reencaminhado para uma nova tela específica de compra, nesta tela ele insere o código do produto, e aperta o botão comprar , neste botão comprar eu coloco um evento para a resposta do banco de dados do servidor ser exibida em um JTextArea. Toda esta interface gráfica está contida dentro de um JPanel ->que está acima do JInternalFrame. Mas eu não estou conseguindo exibir a resposta do servidor.
O engraçado é que qndo eu acesso o método do servidor listaProduto(); ele exibe tudo no JTextArea.
O código que não está funcionando é este:

package org.ws.cliente.commerce;


import java.util.List;
import org.ws.client.Produto;
import org.ws.client.TesteCompraWs;
import org.ws.client.TesteCompraWsService;


/**
 *
 * @author AndrePush
 */
public class TelaCompra extends javax.swing.JInternalFrame {

    /** Creates new form TelaCompra */
    public TelaCompra() {
        initComponents();
        initialize();
    }

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

        compraT = new javax.swing.JPanel();
        javax.swing.JLabel labelcod = new javax.swing.JLabel();
        campoCodigo = new javax.swing.JTextField();
        btComprarCompProduto = new javax.swing.JButton();
        LabelCompraProduto = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        bCancelar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        meuTextCompra = new javax.swing.JTextArea();
        dadosCompra = new javax.swing.JLabel();

        setBackground(new java.awt.Color(102, 153, 255));
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        compraT.setBackground(new java.awt.Color(102, 153, 255));

        labelcod.setFont(new java.awt.Font("Arial", 1, 24));
        labelcod.setForeground(new java.awt.Color(255, 255, 255));
        labelcod.setText("Código:");

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

        btComprarCompProduto.setFont(new java.awt.Font("Arial", 1, 24));
        btComprarCompProduto.setForeground(new java.awt.Color(51, 51, 51));
        btComprarCompProduto.setText("Comprar");
        btComprarCompProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btComprarCompProdutoActionPerformed(evt);
            }
        });

        LabelCompraProduto.setFont(new java.awt.Font("Arial", 1, 24));
        LabelCompraProduto.setForeground(new java.awt.Color(255, 255, 255));
        LabelCompraProduto.setText(".:COMPRA DE PRODUTO:.");

        jSeparator1.setForeground(new java.awt.Color(255, 255, 255));

        bCancelar.setFont(new java.awt.Font("Arial", 1, 24));
        bCancelar.setForeground(new java.awt.Color(51, 51, 51));
        bCancelar.setText("Cancelar");
        bCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bCancelarActionPerformed(evt);
            }
        });

        meuTextCompra.setColumns(20);
        meuTextCompra.setRows(5);
        meuTextCompra.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                meuTextCompraAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });
        jScrollPane1.setViewportView(meuTextCompra);

        dadosCompra.setFont(new java.awt.Font("Arial", 1, 24));
        dadosCompra.setForeground(new java.awt.Color(255, 255, 255));
        dadosCompra.setText("DADOS DA COMPRA:");

        javax.swing.GroupLayout compraTLayout = new javax.swing.GroupLayout(compraT);
        compraT.setLayout(compraTLayout);
        compraTLayout.setHorizontalGroup(
            compraTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(compraTLayout.createSequentialGroup()
                .addGap(195, 195, 195)
                .addComponent(LabelCompraProduto)
                .addContainerGap(151, Short.MAX_VALUE))
            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE)
            .addGroup(compraTLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelcod)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 344, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(196, Short.MAX_VALUE))
            .addGroup(compraTLayout.createSequentialGroup()
                .addGroup(compraTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(compraTLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btComprarCompProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(bCancelar))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, compraTLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(dadosCompra)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(77, Short.MAX_VALUE))
        );
        compraTLayout.setVerticalGroup(
            compraTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(compraTLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(LabelCompraProduto)
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(compraTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelcod)
                    .addComponent(campoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addGroup(compraTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btComprarCompProduto))
                .addGroup(compraTLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(compraTLayout.createSequentialGroup()
                        .addGap(101, 101, 101)
                        .addComponent(dadosCompra)
                        .addGap(183, 183, 183))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, compraTLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29))))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(compraT, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(compraT, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

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

    private void campoCodigoActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
    }                                           

    [b]private void btComprarCompProdutoActionPerformed(java.awt.event.ActionEvent evt) {                                                     
        // TODO add your handling code here:
    TesteCompraWsService service = new TesteCompraWsService();
    TesteCompraWs port = service.getTesteCompraWsPort();

        List<Produto> compProd = port.compraProduto
        (Integer.parseInt(campoCodigo.getText()));

        for(Produto pd : compProd){
            pd.getCodigo();
            meuTextCompra.setText(pd.getDescricao());
            
        }

    }                                [/b]                    

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

    private void meuTextCompraAncestorAdded(javax.swing.event.AncestorEvent evt) {                                            
        // TODO add your handling code here:
        
    }                                           

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

    });
    }*/
    public void run() {
        new TelaCompra().setVisible(true);
    }

    public void initialize() {
        this.setTitle("Comprar Produto");
    }
    // Variables declaration - do not modify                     
    private javax.swing.JLabel LabelCompraProduto;
    private javax.swing.JButton bCancelar;
    private javax.swing.JButton btComprarCompProduto;
    private javax.swing.JTextField campoCodigo;
    private javax.swing.JPanel compraT;
    private javax.swing.JLabel dadosCompra;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextArea meuTextCompra;
    // End of variables declaration                   
}

Eu destaquei o método em negrito. Estou utilizando a IDE NetBeans 6.8, BD PostgreSQL 8.4, e framework java para SOAP JAX-WS 2.1;

Se alguém souber por favor responde aí.

Aguardo respostas.

Você notou que usando o .setText no JTextArea você só exibirá o último produto que passar por aquele for?
Se você quer adicionar texto no JTextArea sem apagar o conteúdo, use o método append.

Outra coisa. O que é aquela chamada a pd.getCodigo() vazia ali no for?

O .setText no JTextArea é para exibir o produto comprado mesmo, no caso o último mesmo.
Eu tentei o método append cara, mas não está rodando e tbm não acusa nenhum erro.

A chama pd.getCodigo() eu era para pegar o código e neste método eu já tentei pd.setCodigo() mas tbm não funciona.

Oq pode estar errado ViniGodoy?

vlws

[quote=AndrePush]O .setText no JTextArea é para exibir o produto comprado mesmo, no caso o último mesmo.
Eu tentei o método append cara, mas não está rodando e tbm não acusa nenhum erro.

A chama pd.getCodigo() eu era para pegar o código e neste método eu já tentei pd.setCodigo() mas tbm não funciona.

Oq pode estar errado ViniGodoy?

vlws[/quote]

 TesteCompraWsService service = new TesteCompraWsService();  
     TesteCompraWs port = service.getTesteCompraWsPort();  
   
         List<Produto> compProd = port.compraProduto  
         (Integer.parseInt(campoCodigo.getText()));  
   
         for(Produto pd : compProd){  
             pd.getCodigo();  
             meuTextCompra.setText(pd.getDescricao());  
               
         }  
   
     }        

oq o ViniGodoy quis dizer é q a sua chamada pd.getCodigo(); provavelmente retorna alguma coisa e vc não está atribuindo a nenhuma variavel.

Olá pessoal, consegui resolver o problema…
Bom tive que fazer um POGzinho…mas é uma resolução.
Segue o código para que outras pessoas que tenham o mesmo ou qse o mesmo problema consigam resolver.

private void btComprarCompProdutoActionPerformed(java.awt.event.ActionEvent evt) {                                                     
        // TODO add your handling code here:
    TesteCompraWsService service = new TesteCompraWsService();
    TesteCompraWs port = service.getTesteCompraWsPort();

        List<Produto> compProd = port.compraProduto
        (Integer.parseInt(campoCodigo.getText()));
        StringBuffer sb = new StringBuffer();

        for(Produto pd : compProd){
            //pd.getCodigo();//
            sb.append("Codigo:\n - ").append(pd.getCodigo());
            sb.append(pd.getValor()).append("\n - ");
            sb.append(pd.getTotal()).append("\n - ");

          //  sb.append(pd.getDescricao()).append(" - ");
           // sb.append(pd.getMarca());
            
        }

        meuTextCompra.setText(sb.toString());

    }

Ainda não está concluído mas é parte.
Vlws a todos que me ajudaram!