Here you can find the source of drawButtonBorder(Graphics g, int x, int y, int w, int h, Color backgroundColor, Color edgeColor, Color cornerColor)
public static void drawButtonBorder(Graphics g, int x, int y, int w, int h, Color backgroundColor, Color edgeColor, Color cornerColor)
//package com.java2s; import java.awt.Color; import java.awt.Graphics; public class Main { /**//from w w w .ja va2 s . c o m * Draws a button border for an xp button with the given colors. */ public static void drawButtonBorder(Graphics g, int x, int y, int w, int h, Color backgroundColor, Color edgeColor, Color cornerColor) { g.translate(x, y); // Edges g.setColor(edgeColor); drawRect(g, 0, 0, w - 1, h - 1); // Near corners g.setColor(cornerColor); g.fillRect(0, 0, 2, 2); g.fillRect(0, h - 2, 2, 2); g.fillRect(w - 2, 0, 2, 2); g.fillRect(w - 2, h - 2, 2, 2); // Corners g.setColor(backgroundColor); g.fillRect(0, 0, 1, 1); g.fillRect(0, h - 1, 1, 1); g.fillRect(w - 1, 0, 1, 1); g.fillRect(w - 1, h - 1, 1, 1); g.translate(-x, -y); } /** * An optimized version of Graphics.drawRect. */ static void drawRect(Graphics g, int x, int y, int w, int h) { 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); } }