import java.applet.*; import java.awt.*; // double buffered and clipped public class Broadway2 extends Broadway { Graphics offscreen; Image image; public void init() { super.init(); image = createImage(300,300); offscreen = image.getGraphics(); } public void paint(Graphics g) { System.out.println(">> paint <<"); offscreen.setColor(Color.black); offscreen.fillRect(0,0,300,300); // clear buffer offscreen.setColor(Color.yellow); offscreen.fillRect(0,0,90,90); offscreen.fillRect(250,0,40,190); offscreen.fillRect(80,110,100,20); offscreen.setColor(Color.blue); offscreen.fillRect(80,200,220,90); offscreen.fillRect(100,10,90,80); offscreen.setColor(Color.lightGray); offscreen.fillRect(locx,locy,width,height); offscreen.setColor(Color.red); offscreen.fillRect(200,0,45,45); offscreen.fillRect(0,100,70,200); offscreen.setColor(Color.magenta); offscreen.fillRect(200,55,60,135); g.drawImage(image,0,0,this); } public void update(Graphics g) { g.clipRect(70,90,130,110); paint(g); } }