Thursday, 12 September 2013

Java - how to create delays

Java - how to create delays

I'm wondering how can I make a Java program delay parts of code to prevent
spamming buttons/other things in the program. So let's just say I'm making
a program that displays the amount of times a user has clicked a button. I
would like there to be a delay to the user cannot click the button
rapidly. I heard that java timers could help me, but I can't find any
tutorial explaining what I need done.
public void ButtonActionPerformed(java.awt.event.ActionEvent evt) {
count+=1;
labelA.setText(Integer.toString(count));
}
This is just an example program, not what im actually working on. So can
someone please help me? I need to have a program create a delay so the
user cannot spam buttons. Thanks :) (this is a revised question from
before)

No comments:

Post a Comment