I am new to Java Development, i have a Jframe1 which opens a new window Jframe2 with the object passing inside the constructor like this,
final EmployeeLookUp f = new EmployeeLookUp(this);
And the Jframe2 constructor looks like,
public EmployeeLookUp(LibraryHR lhr1) {
initComponents();
lhr = lhr1;
}
Am making some changes inside the object lhr and i want to pass the modified object back to the Main frame On clicking the ok button. How can i do that?
final EmployeeLookUp f = new EmployeeLookUp(this);
f.show();
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
f.addWindowListener( new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
//i want to get the object from Jframe2 to here
}
} );
EDIT:
My question is how to pass the object in Frame2 to Frame1 in closing event of Frame2?