Java examples for 2D Graphics:Rectangle
fill Thwart Foggy Rect
//package com.java2s; import java.awt.Graphics; public class Main { public static void fillThwartFoggyRect(Graphics g, int x, int y, int width, int height) { for (int i = x; i < width + x; i += 2) { for (int j = y; j < height + y; j += 2) { g.fillRect(i, j, 1, 1);//from ww w .j a va 2s .c om } } } }