public synchronized void setSize(int width, int height) { if (this.width == width && this.height == height) { return; } else { frontbufferValid = false; state = 0; backbuffer = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); frontbuffer = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); this.width = width; this.height = height; screen.setSize(width, height); this.notifyAll(); } }