I am writing a Java program and I want to present the user with a settings window when they run a function in the main GUI so they can set the parameters which are used in the function.
Ideally what I would like to do in the main function (part of the main GUI JFrame) is;
- Create an instance of the settings window (JFrame or maybe JDialog?)
- Display the settings window
- WAIT for the user to input some values and press the OK button in the settings window
- Retrieve the values from the settings window
- Run the rest of the function
My problem is 'pausing' the main function until the OK button has been pressed. I can't figure out how this should be done? I suppose it is very similar to the operation of a message box or a JFileChooser.
Sorry if this is a bit basic/obvious, but I'm more of a scientist than a programmer. If anyone could point me in the right direction I'd be very grateful.