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?

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.