1
I tried it in various ways, but I couldn’t find a solution. When I click the save button. I want him to throw the dice on that Jlist to the other Jlist that’s in the Other Jframe. "I couldn’t 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 help me?
here is a Google drive link from a program Example: drive.google.com/open? id=0B3LW2w_eQoq4V3BhV0hiQ1o1dnM
The code worked, now I’m trying to implement in my program
– Mateus Silveira
@Mateussilveira tests there, anything warns here.
– user28595
Sorry for the delay. I’m not able to implement. I’ll make an example and send the link to Google Drive for you to see better.
– Mateus Silveira
https://drive.google.com/open?id=0B3LW2w_eQoq4V3BhV0hiQ1o1dnM
– Mateus Silveira
@Mateussilveira https://ufile.io/abf14 tests there, but already I say that is not a good solution, you are mixing business logic with canvas, I could hardly find the lists. The editor should be used only to make the window, no logic at all, and then you add it manually, not via drag and drop, so it avoids this scrambling of code that makes it even difficult for yourself.
– user28595
Thanks! It worked, and thanks for the tips
– Mateus Silveira