Saturday, 17 August 2013

How do I find out if the mouse has been clicked?

How do I find out if the mouse has been clicked?

In my program I have a 1/10 second delay. I need to find out if the mouse
has been clicked during that time so that the program can do something.
What is the command for doing that?
public void delay() {
for (int i = 0; i<100;i++) {
try {
Thread.sleep(1);
}
catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
if (mouse has been clikced)
dosomething();
}
}

No comments:

Post a Comment