Jump to content
  • Advertisement
Sign in to follow this  
Stroker_Ace

[java] JFrame BufferStrategy - screen not clearing.

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

Hi, I am having problems using BufferStratgy with my subclass of JFrame . When I call the show method the new Image is written over the top of the old one. Can anyone help me understand why each screen updates appear on top of eachother? private BufferStrategy bf; ... // Constructor setIgnoreRepaint(true); createBufferStrategy(2); bf = getBufferStrategy(); // My JFrame subclass implements ActionListener. // This routine is called when a javax.sing.Timer event fires. public void actionPerformed(ActionEvent e) { Graphics g = bf.getDrawGraphics(); //Draw items to Graphics object g.dispose(); bf.show(); } Thanks for any help. EDIT: Problem solved - I was not clearing the graphics object before each redraw! [Edited by - Stroker_Ace on April 2, 2008 2:17:10 AM]

Share this post


Link to post
Share on other sites
Advertisement
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!