Change the size of backbuffer when resized

Hi i have a backbuffer and a graphicsbuffer :

public Image offScreenImage;
public Graphics offScreenGraphics;

in my paint() method i have this :

width = getSize().width;
height = getSize().height;


// Create off screen image
if(offScreenGraphics == null) {
   offScreenImage = createImage(width, height);
   offScreenGraphics=offScreenImage.getGraphics();
}

how can i change the size of the image and the backbuffergraphics when my window is resized ?

Tx
Phil

(i hope it’s the right place to ask,…first topic for me !)

Store the width and height. Then as part of your if statement - say…

if(offScreen==null || storedWidth!=getWidth() || storedHeight!=getHeight) …

Make sure you dispose() of the old graphics before recreating it…

The problem is that i want to do it only when i resized the window. Must I use a componentlistener ?

if yes do you have info about how to implement it ?

Tx
Phil