Search code examples
javaappletawtgraphics2djapplet

How to get / use bufferstrategy in a Java applet?


I was wondering how I would use something like a bufferstrategy in a Java Applet.

I want to draw something like an image

gfx.drawImage(frame, 0, 0, width, height, null);

to my applet but I am getting white flashes due to the graphics drawing to the screen not being buffered.

Any help would be greatly appreciated!

Edit: I have a thread that is repainting this image

Edit 2: The image is constantly changing so I need to repaint it each time it changes


Solution

  • Ah, so the public void update(Graphics g) method doesn't have white flashes due to the graphics drawing to the screen not being buffered. But the paint method does. Odd.