• Advertisement
Sign in to follow this  

[java] JFrame BufferStrategy - screen not clearing.

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