I tried several ways, but I could not find a solution. When I click the save button. I want it to throw the data from this Jlist to the other Jlist that is in the Other Jframe. "I could not activate the code block, sorry."
//Método para Adicionar os itens na Jlist
private void btAdicionarGastoActionPerformed(java.awt.event.ActionEvent evt) {
listGasto.setModel(item);
item.addElement(txtNomeGasto.getText() + ": " + txtValorGasto.getText() + " " + "Data: " +txtData.getText());
txtNomeGasto.setText("");
txtValorGasto.setText("R$ ");
}
private void
btSalvarGastoActionPerformed(java.awt.event.ActionEvent evt) {
int k=0;
k = listGasto.getFirstVisibleIndex();
listGasto.setModel(item);
receita.setItems((ArrayList<String>) item.getElementAt(k));
this.hide();
}
//Codigo no outro Jframe
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
frm = new frmGastos();
gastos = new DefaultListModel();
listDadosGasto.setModel(gastos);
gastos.addElement(frm.receita.getItems());
listDadosGasto.repaint();
}
Can you help me?
Here is a Google drive link for a program Example: drive.google.com/open?id=0B3LW2w_eQoq4V3BhV0hiQ1o1dnM