Stop code until a condition is met
问题 How can you create a function or component etc that will stop all running code until a condition is met? For example the same way as a JOptionPane will do, if I have this for example: JOptionPane.showInputDialog(null, "Hello", "Title", 1); Within a function etc and then print to the console afterwards it it will not print until I close the JOptionPane. I am guessing this component has some sort of thread setup built in to do this but how could I duplicate that with my own functions? So say