Java tutorial
//package com.java2s; import java.awt.*; public class Main { public static final Color TEXT_SHADOW_COLOR = new Color(255, 255, 255); public static void drawShadowText(Graphics2D g2, String s, int x, int y) { drawShadowText(g2, s, x, y, TEXT_SHADOW_COLOR, 1); } public static void drawShadowText(Graphics2D g2, String s, int x, int y, Color shadowColor, int offset) { g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); Color c = g2.getColor(); g2.setColor(shadowColor); g2.drawString(s, x, y + offset); g2.setColor(c); g2.drawString(s, x, y); } }