Here you can find the source of paintBorder(Rectangle r, Graphics2D g2d)
protected static void paintBorder(Rectangle r, Graphics2D g2d)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { private static final Color BORDER_DARK_COLOR = Color.BLACK; private static final Color BORDER_LIGHT_COLOR = Color.LIGHT_GRAY; protected static void paintBorder(Rectangle r, Graphics2D g2d) { final int x2 = r.x + r.width - 1; final int y2 = r.y + r.height - 1; g2d.setColor(BORDER_DARK_COLOR); g2d.drawLine(r.x, r.y, r.x, y2 - 1); g2d.drawLine(r.x, r.y, x2, r.y); g2d.setColor(BORDER_LIGHT_COLOR); g2d.drawLine(r.x, y2, x2, y2);//from w ww. ja v a 2s . c o m g2d.drawLine(x2, r.y + 1, x2, y2); } }