Devi passare al secondo JFrame un riferimento al primo, creando un costruttore che riceve come parametro un oggetto di tipo MyFrame:
Codice PHP:
public class MyFrame extends javax.swing.JFrame {
private String testo;
...
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
new LittleJFrame(this).setVisible(true);
}
public String getTesto() {
return testo;
}
public void setTesto(String testo) {
this.testo = testo;
}
}
E nel LittleJFrame:
Codice PHP:
public class LittleJFrame extends javax.swing.JFrame {
MyFrame rif;
...
public LittleJFrame (MyFrame rif) {
...
this.rif=rif;
}
....
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
rif.setTesto(this.jTextField1.getText());
}
}
A questo punto nel primo JFrame hai la stringa col valore settato.