Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Chaucer

[java] canvas in a jframe

This topic is 5724 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

Ok, in the past, all of my java game programming has been done in applets. So now I need to plot some points but it has to be an application. I was thinking about just creating a canvas, drawing on it, and then adding it to a jframe. The problem is that I don''t know much about canvas'' Do I have to make it a thread and have a repaint() every few seconds?

Share this post


Link to post
Share on other sites
Advertisement
I think it depends on what you are doing. You can create a thread (or a Timer) object to ''repaint()'' the canvas at intervals. The best way of doing it would to repaint the canvas only when you need to, everytime the canvas changes, repaint it to update to the screen.

Seeing that you have create applets before, you might be used to repainting the canvas continously (as in an applet). This is done easily by creating a javax.swing.Timer object to 0 intervals (update all the time) to repaint the canvas by calling repaint().

Share this post


Link to post
Share on other sites

  • 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!