I have this code where I want to get user input in the middle of a loop. So it will look something like this:

do{
//wait for user input
//code to be executed based on user input
}while(true)

If I were to use a Scanner, the program will wait for the user to enter the information, and then it will proceed with the code.
However, I would like to use a JButton instead, so user input is interpreted...