Hey all! I'm hoping someone can help me figure this out because I'm a bit confused.
I am setting up a timer which bases its timeout value on a variable.
Here is the code in question:
If I hard-code the value '5000' in for "processTime", it works perfectly, but I need to be able to change the processTime value, so hard-coding the value is not an option.
Right now it doesn't seem like the timer waits at all. I know that the code located in the ActionListener class gets executed when i call goToMask.start(), but it doesn't have the right wait time.
Any help would be greatly appreciated! Thanks!
I am setting up a timer which bases its timeout value on a variable.
Here is the code in question:
Code:
int processTime = 5000;
javax.swing.Timer goToMask;
goToMask = new javax.swing.Timer(processTime, new ActionListener() {
public void actionPerformed(ActionEvent e) {
goToMask.stop();
// Rest of code to execute after timeout
}
});
If I hard-code the value '5000' in for "processTime", it works perfectly, but I need to be able to change the processTime value, so hard-coding the value is not an option.
Right now it doesn't seem like the timer waits at all. I know that the code located in the ActionListener class gets executed when i call goToMask.start(), but it doesn't have the right wait time.
Any help would be greatly appreciated! Thanks!