Ajuda com jtable e jbutton

1 resposta
R

Boa tarde amigos, estou desenvolvendo um formulario de orçamento de vendas. Estou na parte aonde o usuario adiciona os produtos. No caso, eu procuro o produto e carrego, informo a quantidade e clico no Botão AdicionarProduto, deveria no caso adicionar o produto na TabelaProduto, mas esta dando erro.

Segue abaixo, o evento do botao.

private void btnAdicionaProdutoActionPerformed(java.awt.event.ActionEvent evt) {                                                   
        DefaultTableModel dtm = (DefaultTableModel) tableProdutos.getModel();
        dtm.addRow(new Object[]{txtFieldCodigoProduto.getText(), txtFieldDescricaoProduto.getText(),
                    txtFieldUnidadeProduto.getText(), txtFieldQuantidadeProduto.getText(),
                    txtFieldValorUnitarioProduto.getText(), txtFieldValorTotalProduto.getText()});

        txtFieldCodigoProduto.setText("");
        txtFieldDescricaoProduto.setText("");
        txtFieldUnidadeProduto.setText("");
        txtFieldQuantidadeProduto.setText("");
        txtFieldValorUnitarioProduto.setText("");
        txtFieldValorTotalProduto.setText("");
}
Segue abaixo os erros quando eu clico no Botão AdicionarProduto.

[color=red]23/09/2009 14:56:29 org.hibernate.impl.SessionFactoryObjectFactory addInstance

INFO: Not binding factory to JNDI, no JNDI name configured

Hibernate: select this_.codigo as codigo5_0_, this_.classificacaofiscal as classifi2_5_0_, this_.codigoFabricante as codigoFa3_5_0_, this_.dataCadastro as dataCada4_5_0_, this_.descricao as descricao5_0_, this_.frete as frete5_0_, this_.grupo as grupo5_0_, this_.icms as icms5_0_, this_.ipi as ipi5_0_, this_.margemLucro as margemL10_5_0_, this_.outrosCustos as outrosC11_5_0_, this_.pesoBruto as pesoBruto5_0_, this_.pesoLiquido as pesoLiq13_5_0_, this_.precoCusto as precoCusto5_0_, this_.precoVenda as precoVenda5_0_, this_.quantidadeMaxima as quantid16_5_0_, this_.quantidadeMinima as quantid17_5_0_, this_.quantidadeProduto as quantid18_5_0_, this_.subgrupo as subgrupo5_0_, this_.ultimaCompra as ultimaC20_5_0_, this_.ultimaVenda as ultimaV21_5_0_, this_.unidade as unidade5_0_ from produto this_ where this_.descricao like ?

Hibernate: select this_.codigo as codigo5_0_, this_.classificacaofiscal as classifi2_5_0_, this_.codigoFabricante as codigoFa3_5_0_, this_.dataCadastro as dataCada4_5_0_, this_.descricao as descricao5_0_, this_.frete as frete5_0_, this_.grupo as grupo5_0_, this_.icms as icms5_0_, this_.ipi as ipi5_0_, this_.margemLucro as margemL10_5_0_, this_.outrosCustos as outrosC11_5_0_, this_.pesoBruto as pesoBruto5_0_, this_.pesoLiquido as pesoLiq13_5_0_, this_.precoCusto as precoCusto5_0_, this_.precoVenda as precoVenda5_0_, this_.quantidadeMaxima as quantid16_5_0_, this_.quantidadeMinima as quantid17_5_0_, this_.quantidadeProduto as quantid18_5_0_, this_.subgrupo as subgrupo5_0_, this_.ultimaCompra as ultimaC20_5_0_, this_.ultimaVenda as ultimaV21_5_0_, this_.unidade as unidade5_0_ from produto this_ where this_.codigo=?

Exception in thread AWT-EventQueue-0 java.lang.IllegalArgumentException: Cannot format given Object as a Number

at java.text.DecimalFormat.format(DecimalFormat.java:487)

at java.text.Format.format(Format.java:140)

at javax.swing.JTable$DoubleRenderer.setValue(JTable.java:5361)

at javax.swing.table.DefaultTableCellRenderer.getTableCellRendererComponent(DefaultTableCellRenderer.java:237)

at javax.swing.JTable.prepareRenderer(JTable.java:5729)

at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2075)

at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1977)

at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1773)

at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)

at javax.swing.JComponent.paintComponent(JComponent.java:763)

at javax.swing.JComponent.paint(JComponent.java:1029)

at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)

at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1475)

at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1406)

at javax.swing.RepaintManager.paint(RepaintManager.java:1220)

at javax.swing.JComponent._paintImmediately(JComponent.java:5072)

at javax.swing.JComponent.paintImmediately(JComponent.java:4882)

at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:803)

at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714)

at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694)

at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

CONSTRUÇÃO PARADA (tempo total: 20 segundos)[/color]

Por favor amigos, peço uma ajuda para meu problema. Obrigado.

1 Resposta

R

Resolvido .

Obrigado a todos !!!

Criado 23 de setembro de 2009
Ultima resposta 28 de set. de 2009
Respostas 1
Participantes 1