pessoal estou com o seguinte problema eu tenho uma Jtable aonde eu gerencio os atendimentos. nessa tabela eu tenho uma coluna chamada “valor total” aonde os valores pegos de outra tabela são enviados para essa, aonde os valores são formatados com NumberFormat e eu preciso efetuar a soma de todos esses valores e enviar o valor somado da coluna para outra tabela aonde os dados estão formatados. já tentei com decimalFormat e não deu. alguém pode me ajudar??
segue as imagens
Tabela gerenciar atendimento
segue o codigo!!
private void cadastrarMes(){
try {
MesVO mVO = new MesVO();
mVO.setMes(selecionaMes());
mVO.setvTotal(soma());
MesServicos ms = servicos.ServicosFactory.getMesServicos();
ms.cadastrarMes(mVO);
JOptionPane.showMessageDialog(
null,
"Mes cadastrado com sucesso!",
"Mensagem de confirmação",
JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(
null,
"erro ao cadastrar Mes!",
"Mensagem de erro",
JOptionPane.ERROR_MESSAGE);
}//fecha catch
}//fecha método cadastrar
private void prencherTabelaAtendimento(){
try {
AtendimentoServicos as = ServicosFactory.getAtendimentoServicos();
ArrayList<AtendimentoVO> aten = new ArrayList<>();
aten = as.buscarAtendimento();
NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
DecimalFormat df = new DecimalFormat("0.00");
for(int i = 0; i < aten.size(); i++){
dtm.addRow(new String[]{
String.valueOf(aten.get(i).getIdAtendimento()),
String.valueOf(aten.get(i).getNomeCliente()),
String.valueOf(aten.get(i).getFPagamento()),
nf.format(aten.get(i).getValorTotal())
});
}//fecha for
jtTabelaAtendimentos.setModel(dtm);
} catch (Exception e) {
JOptionPane.showMessageDialog(
null,
"Erro ao Prencher tabela Atendimentos!",
"Mensagem de Erro",
JOptionPane.ERROR_MESSAGE);
}//fecha catch
}//fecha prencher tabela
codigo da tabela mes
private void prencherTabelaMes(){
try {
MesServicos ms = ServicosFactory.getMesServicos();
ArrayList<MesVO> mes = new ArrayList<>();
mes = ms.buscarMes();
NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
for(int i = 0; i < mes.size(); i++){
dtm.addRow(new String[]{
String.valueOf(mes.get(i).getIdMes()),
String.valueOf(mes.get(i).getMes()),
nf.format(mes.get(i).getvTotal())
});
}//fecha for
jtMes.setModel(dtm);
} catch (Exception e) {
JOptionPane.showMessageDialog(
null,
"Erro ao Prencher tabela do Mes!",
"Mensagem de Erro",
JOptionPane.ERROR_MESSAGE);
}//fecha catch
}//fecha prencher tabela