Hi, I'm developing an application, with a main GUI and another GUI that gathers some information. Upon clicking a button in the main GUI, it initializes a second GUI object that has fields for input and then an "OK" button. I need to be able to return the information in the second GUI to the first GUI in the form of an object array, but only after the OK button is clicked.
Both GUIs are very simple, extend JFrame, are non-static, and are run by creating an object and setting its visibility and size.
I assume I will have to use threads, I just cannot figure out how to use them with these GUI object classes.
This is the code from the Main GUI, EditUser is the name of the second GUI:
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(addnew)){
EditUser ed = new EditUser();
ed.setSize(159, 143);
ed.setVisible(true);
model.addRow(ed.getUserInput());
}
}
And this is the getUserInput method in the second GUI:
public Object[] getUserInput() {
return new Object[] { nameField.getText(),
RankString.getRank(editRanksCombo.getSelectedIndex()),
v2tag.isSelected() };
}
The issue is that it doesn't allow the user time to make a decision, it just gets what was given when the second GUI was created.
How do I make the first GUI wait until the second one's OK button was pressed?
Thank you in advance.