I'm creating a board with many separate little squares, I want to fill the squares with the parts of the image so they go together to form the original image. How do I do that? What class should I look into? And by the way I'm drawing the board with paintComponent.
public void paintComponent(Graphics g) {
super.paintComponent(g);
int boxHeight = boxHeight();
int boxWidth = boxWidth();
for (int row = 0; row < game.getRows(); row++) {
for (int col = 0; col < game.getCols(); col++) {
g.setColor(Color.lightGray);
g.drawRect(col * boxWidth, row * boxHeight, boxWidth, boxHeight);
//this is where I want to fill the rectangles
if (game.isAlive(row, col)) {
g.setColor(color);
g.fillRect(col * boxWidth, row * boxHeight, boxWidth, boxHeight);
}
}
}
}