// . import java.applet.Applet; import java.awt.*; public class TerribleFlicker extends Applet { Image img; int imgWidth = 300, imgHeight = 225; int grid = 10; int currentx, currenty; // load the image when the applet begins executing public void init() { img = getImage( getDocumentBase(), "ms.jpg" ); } // display the image public void paint( Graphics g ) { int w = size().width/grid; int h = size().height/grid; boolean black = false; for (int y=0;y<=grid;y++) for (int x=0; x <= grid; x++) { g.setColor ( (black = !black) ? Color.black : Color.white); g.fillRect ( x * w, y * h, w, h); } // draw the original image g.drawImage( img, currentx, currenty, this ); } public boolean mouseDrag (Event e, int x, int y) { currentx = x; currenty = y; repaint(); return true; } }