Here you can find the source of drawString(Graphics2D gfx, String text, int x, int y)
public static void drawString(Graphics2D gfx, String text, int x, int y)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static void drawString(Graphics2D gfx, String text, int x, int y) { Color color = gfx.getColor(); /// Don't draw a shadow if the text is really dark. if (gfx.getColor().getRed() >= 33 || gfx.getColor().getBlue() >= 33 || gfx.getColor().getGreen() >= 33) { gfx.setColor(Color.BLACK); // Shadow gfx.drawString(text, x + 1, y + 1); }/*from w ww.j av a 2 s. c om*/ gfx.setColor(color); gfx.drawString(text, x, y); } }