Hola, quisiera saber como mostrar los datos que están en mi jframe padre por un jtable que se encuentra en un jdialog , las 2 clases se encuentran en el mismo.
Código jFrame:
Código Java:
Ver originalpublic jFrame() {
initComponents();
setLocationRelativeTo(this);
gestion = new Gestion();
}
private void botonGuardarUnaNuevaEstampillaActionPerformed
(java.
awt.
event.
ActionEvent evt
) {
double valor;
long id;
try{
pais = jTextFieldPais.getText();
fecha = jTextFieldFecha.getText();
valor
= Double.
parseDouble(jTextFieldValor1.
getText()); id
= Long.
parseLong(jTextFieldId.
getText());
gestion.crearEstampilla(id, fecha, pais, valor);
JOptionPane.
showMessageDialog(rootPane, e.
getMessage()); }finally{
jTextFieldFecha.setText("");
jTextFieldPais.setText("");
jTextFieldValor1.setText("");
jTextFieldId.setText("");
}
}
public Gestion getGestion(){
return gestion;
}
private void botonVerReportesActionPerformed
(java.
awt.
event.
ActionEvent evt
) {
JDialog dialog
= new jDialog
(this,
true); dialog.setVisible(rootPaneCheckingEnabled);
}
Código jDialog:
Código Java:
Ver originalpublic jDialog
(java.
awt.
Frame parent,
boolean modal
) { super(parent, modal);
initComponents();
setLocationRelativeTo(this);
visual = new jFrame();
}
private void botonMostrarInfoTablaActionPerformed
(java.
awt.
event.
ActionEvent evt
) { gestion = visual.getGestion();
au=gestion.getCont();
for(int i=0; i<au; i++){
jTable1.setValueAt(gestion.getEstampillas()[i].getId(), i, 0);
jTable1.setValueAt(gestion.getEstampillas()[i].getPais(), i, 1);
jTable1.setValueAt(gestion.getEstampillas()[i].getValorF(), i, 2);
jTable1.setValueAt(gestion.getEstampillas()[i].getFecha(), i, 3);
}
}
private void jButtonrRegresarActionPerformed
(java.
awt.
event.
ActionEvent evt
) { visual.
setDefaultCloseOperation(JDialog.
DISPOSE_ON_CLOSE); visual.setVisible(true);
}
public static void main
(String args
[]) {
public void run() {
jDialog dialog
= new jDialog
(new javax.
swing.
JFrame(),
true); @Override
public void windowClosing
(java.
awt.
event.
WindowEvent e
) { }
});
dialog.setVisible(true);
}
});
}