I'm working on my first big multi-file Java program. When the program starts, my main file calls another file that creates a GUI, populates it and accepts information. It then is supposed to return an ArrayList, which my main file is supposed to use.
The issue is that my GUI method is immediately returning with an empty ArrayList, instead of waiting until after a button has been pushed.
This is currently how my ActionListeners work
close.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.exit(0);
}
});
start.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
temp = pullInfo(txtOrder, txtRounds);
}
});
Where temp is the ArrayList that I want to return at the end.
This is what I have in my main file:
JFrame launch = new LaunchWindow();
ArrayList<Integer> temp = ((LaunchWindow) launch).createGUI();
rounds = temp.get(0);
temp.remove(0);
order = temp;
connect();
I don't want it to run the rounds = temp.get(0); until after that ArrayList has been populated. How can I make it wait until a button is pushed?