|
-
March 27th, 1999, 12:22 AM
#1
waiting for a mouse event
This problem probably has a really simple solution but it has me stumped. I am basically trying to get the code in my main() method to wait (do nothing) until the user clicks on a certain JButton component.
What I tried was to put a small loop in the main() method that would exit when a flag variable was set by my MouseEventListener method like so:
In main() ->
while(!clicked) ; //do nothing
In Listener ->
public void mouseClicked(...)
{ clicked = true; }
Not only does this not work but it wastes a lot of CPU time doing nothing! Please tell me how to do this right!
Thanks ahead of time!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|