Here you can find the source of drawRect(Graphics g, int x, int y, int w, int h)
private static void drawRect(Graphics g, int x, int y, int w, int h)
//package com.java2s; import java.awt.*; public class Main { private static void drawRect(Graphics g, int x, int y, int w, int h) { g.fillRect(x, y, w + 1, 1);/*w w w . java 2 s. com*/ g.fillRect(x, y + 1, 1, h); g.fillRect(x + 1, y + h, w, 1); g.fillRect(x + w, y + 1, 1, h); } }