Java examples for 2D Graphics:Text
draw String
//package com.java2s; import java.awt.*; public class Main { public static void drawString(Graphics g, String text, int x, int y) { for (String line : text.split("\n")) { g.drawString(line, x, y += g.getFontMetrics().getHeight()); }/* w w w . ja v a2s.c o m*/ } }