Java examples for 2D Graphics:Rectangle
draw Rect
//package com.java2s; import java.awt.Color; import java.awt.Graphics; public class Main { public static void drawRect(Graphics offLineBuffer, Color color, int x, int y, int width, int height) { offLineBuffer.setColor(color);//from w ww . java 2s . c om offLineBuffer.drawRect(x, y, width, height); } }