import java.awt.image.BufferedImage; import java.awt.Graphics; import javax.swing.JPanel; public class PixelGrid extends JPanel { public BufferedImage grid; int PIXEL_SIZE = 16; public PixelGrid(int width, int height) { grid = new BufferedImage(width*PIXEL_SIZE, height*PIXEL_SIZE, BufferedImage.TYPE_BYTE_GRAY); } public void setPixel(int color, int x, int y) { color = 255-color; x = convertGridIndexToActual(x); y = convertGridIndexToActual(y); for(int i = 0; i