How to do double buffering in Java2D?

I draw a bunch of primitives using Java2D on the screen and I get a lot of tearing / blinking.

How can I enable / use double buffering to display it on the screen and then display it all?

+5
source share
3 answers
+1
source

Some Tips for Using Buffering Effectively as a View Programmer

and some testing programs are available

+1
source

1) BufferedImage. , , , .

, BufferedImage, Graphics2D, paint ( , ...)

[http://www.exampledepot.com/egs/java.awt.image/CreateBuf.html][1]

2) [getGraphics()], , Graphics2D , ( ).

3) You draw a buffered image on your component by overriding its paint method and calling the drawImage () option in the Graphics2D argument passed to the component.

lmk if you need some sample code ...

+1
source

All Articles