Jump to content
  • Advertisement
Sign in to follow this  
banhminds

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

This topic is 4070 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
Advertisement
Does "this" implement ActionListener?

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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!