Sign in to follow this  

can't find constructor Timer(speed, this) problem java problem timers AH?

This topic is 3856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make a timer in my game which is a JApplet, and I went by this tutorial timer use page from java.sun.com website and they say use this, "timer = new Timer(speed, this); timer.setInitialDelay(pause); timer.start(); " but when i did exactly that I get an error can't find constructor new Timer(int, main) here's what code I have for this. Timer timer; public void init() { timer = new Timer(speed, this); timer.start(); } It says it can't find the constructor for the Timer, but i have import javax.swing.*; import javax.swing.Timer; I can't figure this out and I'm getting mad someone please help Thanks in advance

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Does "this" implement ActionListener?

If so, which version of Java/compiler are you using?


Thank you, Thank you, you are a GOD!

I made my JApplet implement actionlistner I didn't do any addActionListener to the init() method, since I didn't see anything that could use it, but then I hit compiled, and it worked.

Thank you, Thank you,



Share this post


Link to post
Share on other sites

This topic is 3856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this