I have a Timer
that works like this:
public void startTourButton(ActionEvent event) {
new Timer ().schedule(
new TimerTask () {
public void run(){
System.out.println("Going to do something here");
}
}, 0, 5000);
}
I am trying to cancel the Timer
from a different event
here:
public void stopTourButton(ActionEvent event) {
Timer.cancel();
}
I get an error
Cannot make a static reference to the non-static method cancel() from the type Timer
How can I fix this?