Jump to content
  • Advertisement
Sign in to follow this  
Giuoco

[java] Double Buffer with Java Swing?

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

Check out the note on this web page (2nd paragraph): Java Double Buffer explained Note: When you are rendering into a Swing component, Swing automatically double-buffers the display. Is this true? Anyone have any experience with the idea that swing double buffers it's graphics automatically?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Giuoco
Is this true?

Yes. Iirc, as of JDK 1.3 all Swing widgets use double buffering by default.

Quote:
Original post by Giuoco
Anyone have any experience with the idea that swing double buffers it's graphics automatically?

Yes, what exactly did you want to know ? If you're making a game it's usually not a problem since you'll either use a backbuffer scheme like the one shown in that article (perhaps replacing the BufferedImage with a VolatileImage) or ensure that the widget has been double buffered by Swing and access the backbuffer directly via a BufferStrategy. On the whole, it's fine for Swing to create the a double buffer scheme for you, but what you need to do is to prevent Swing from actually updating it, which will happen every time the display is resized or goes in and out of focus (among 10,000 other things).

Share this post


Link to post
Share on other sites
Thanks for the info stormrunner!

The reason I stumbled across this is because I'm searching for what you mean by BufferStrategy. I see plenty of techniques for double buffering, but with Swing it seems like the normal C++ strategy is sort of mute.

I might be confused. I'll research the key words in your post (backbuffer, BufferedImage, and VolatileImage). See if I can find a "how to" or a "best practices" article on this topic.

Thanks for the lead.

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!