Here you can find the source of paintOutline(Graphics g, String s, int textX, int textY, int thickness)
public static void paintOutline(Graphics g, String s, int textX, int textY, int thickness)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static Color[] darkGray = new Color[11]; public static void paintOutline(Graphics g, String s, int textX, int textY, int thickness) { if (thickness > 10) { thickness = 10;/*from w w w. j av a 2s. c om*/ } if (thickness > 0) { g.setColor(getDarkGray(thickness)); for (int i = -thickness; i <= thickness; i++) { for (int j = -thickness; j <= thickness; j++) { if (i != 0 || j != 0) { g.drawString(s, textX + i, textY + j); } } } } g.setColor(Color.white); g.drawString(s, textX, textY); } private static Color getDarkGray(int thickness) { if (darkGray[thickness] == null) { darkGray[thickness] = new Color(64, 64, 64, 255 / thickness / thickness); } return darkGray[thickness]; } }