Graphics2D g2 = (Graphics2D)g;
int w = getSize( ).width / grid;
int h = getSize( ).height / grid;
boolean black = false;
for (int y = 0; y <= grid; y++)
for (int x = 0; x <= grid; x++) {
g2.setPaint(black ? Color.black : Color.white);
black = !black;
g2.fillRect(x * w, y * h, w, h);
}
g2.drawImage(image, imageX, imageY,
imageWidth, imageHeight, this);