0

Hello all, Im having a problem using the Timer class. In one class it works fine but in the other; though I do the exact same thing, it doesn't work. I know that the constructor for the Timer class allows no parameters and with parameters, as the other classes uses it like this:

timer = new Timer( 50, this);		
timer.start();

This same class extends the JPanel class and implements the ActionListener class, allowing me to use the keyword this - I assume. But when I do the same thing in the other class it get an error telling me to change the parameters to nothing:

Timer time = new Timer();

Any idea's why this error is rising its head?

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Katana24
0

In the class that doesn't work, you imported the wrong Timer.
What you need is javax.swing.Timer and not java.utils.Timer or some other Timer.

0

Cheers for that, works fine now - thought I was better than that but oh well subtle things are easily missed :P

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.