Here you can find the source of drawInnerButtonDecoration(Graphics g, int x, int y, int w, int h, Color baseColor)
private static void drawInnerButtonDecoration(Graphics g, int x, int y, int w, int h, Color baseColor)
//package com.java2s; import java.awt.Color; import java.awt.Graphics; public class Main { /**/*from w w w. j a v a 2 s .co m*/ * Draws a button border for an xp button with the given colors. */ private static void drawInnerButtonDecoration(Graphics g, int x, int y, int w, int h, Color baseColor) { Color lightColor = translucentColor(baseColor, 90); Color mediumColor = translucentColor(baseColor, 120); Color darkColor = translucentColor(baseColor, 200); g.translate(x, y); g.setColor(lightColor); g.fillRect(2, 1, w - 4, 1); g.setColor(mediumColor); g.fillRect(1, 2, 1, h - 4); g.fillRect(w - 2, 2, 1, h - 4); drawRect(g, 2, 2, w - 5, h - 5); g.setColor(darkColor); g.fillRect(2, h - 2, w - 4, 1); g.translate(-x, -y); } /** * Returns a color that is a translucent copy of the given color. * * @param baseColor the base color * @param alpha the alpha value * @return the translucent color with specified alpha */ private static Color translucentColor(Color baseColor, int alpha) { return new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), alpha); } /** * 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); } }