Hi guys. I don't know how to implement this so i was hoping if any of you can help me.
I have a code like this one:
So i want to do some stuff and wait for a button click to continue. I set up a mouse listener and add it to the button (although the listener does nothing). The problem is, how can i wait for a button click. If this were a non-GUI application, i'd use a scanner and wait for an input from the user, which automatically halts the program. I figured using sleep would hang the application.
Any thoughts?
thanks a lot.
I have a code like this one:
Code:
public static void main (String args[]) { //create frame and button .... frame.setVisible(true); frame.add(button); do { .... // wait for a button click //code to be executed after a button click ..... }while (true); }
Any thoughts?
thanks a lot.
Comment