The list of methods to do Draw Rectangle are organized into topic(s).
void
drawRect(Graphics g, int x, int y, int w, int h) draw Rect
g.fillRect(x, y, w + 1, 1);
g.fillRect(x, y + 1, 1, h);
g.fillRect(x + 1, y + h, w, 1);
g.fillRect(x + w, y + 1, 1, h);
void
drawRectOrOval(Graphics2D g, boolean oval, int arc, int x, int y, int width, int height) draw Rect Or Oval
if (oval) {
g.drawOval(x, y, width, height);
} else {
if (arc == 0) {
g.drawRect(x, y, width, height);
} else {
g.drawRoundRect(x, y, width, height, arc, arc);
void
drawRoundRect(Graphics g, int left, int top, int width, int height, int arcWidth, int arcHeight, int lineWidth) _more_
left = left - lineWidth / 2;
top = top - lineWidth / 2;
width = width + lineWidth;
height = height + lineWidth;
for (int i = 0; i < lineWidth; i++) {
g.drawRoundRect(left, top, width, height, arcWidth, arcHeight);
if ((i + 1) < lineWidth) {
g.drawRoundRect(left, top, width - 1, height - 1, arcWidth, arcHeight);
...
void
drawThickRect(Graphics g, int x, int y, int w, int h, int d) draw Thick Rect
g.fillRect(x, y, w, d);
g.fillRect(x, y + d, d, h - 2 * d);
g.fillRect(x, y + h - d, w, d);
g.fillRect(x + w - d, y + d, d, h - 2 * d);