Here you can find the source of drawString(String txt, int x, int y, Graphics g)
public static void drawString(String txt, int x, int y, Graphics g)
//package com.java2s; //License from project: Open Source License import java.awt.*; import java.awt.image.*; public class Main { private static BufferedImage[] GUI_GLYPH_CHARS; public static void drawString(String txt, int x, int y, Graphics g) { int x2 = 0; for (int v = 0; v < txt.length(); v++) { char c = txt.charAt(v); drawChar(c, x2 + x, y, g);//from w w w . ja v a2s. c om x2 += 8; } } public static void drawChar(char c, int x, int y, Graphics g) { BufferedImage img = null; switch (c) { case ' ': img = GUI_GLYPH_CHARS[0]; break; case '\u0263': img = GUI_GLYPH_CHARS[1]; break; case '!': img = GUI_GLYPH_CHARS[33]; break; case '"': img = GUI_GLYPH_CHARS[34]; break; case '#': img = GUI_GLYPH_CHARS[35]; break; case '$': img = GUI_GLYPH_CHARS[36]; break; case '%': img = GUI_GLYPH_CHARS[37]; break; case '&': img = GUI_GLYPH_CHARS[38]; break; case '\'': img = GUI_GLYPH_CHARS[39]; break; case '(': img = GUI_GLYPH_CHARS[40]; break; case ')': img = GUI_GLYPH_CHARS[41]; break; case '*': img = GUI_GLYPH_CHARS[42]; break; case '+': img = GUI_GLYPH_CHARS[43]; break; case ',': img = GUI_GLYPH_CHARS[44]; break; case '-': img = GUI_GLYPH_CHARS[45]; break; case '.': img = GUI_GLYPH_CHARS[46]; break; case '/': img = GUI_GLYPH_CHARS[47]; break; case '0': img = GUI_GLYPH_CHARS[48]; break; case '1': img = GUI_GLYPH_CHARS[49]; break; case '2': img = GUI_GLYPH_CHARS[50]; break; case '3': img = GUI_GLYPH_CHARS[51]; break; case '4': img = GUI_GLYPH_CHARS[52]; break; case '5': img = GUI_GLYPH_CHARS[53]; break; case '6': img = GUI_GLYPH_CHARS[54]; break; case '7': img = GUI_GLYPH_CHARS[55]; break; case '8': img = GUI_GLYPH_CHARS[56]; break; case '9': img = GUI_GLYPH_CHARS[57]; break; case ':': img = GUI_GLYPH_CHARS[58]; break; } g.drawImage(img, x, y, null); } }