Here you can find the source of drawStringLeft(Graphics2D g, String text, Rectangle rect, int fontHeight, Color c)
public static void drawStringLeft(Graphics2D g, String text, Rectangle rect, int fontHeight, Color c)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Rectangle; public class Main { public static void drawStringLeft(Graphics2D g, String text, Rectangle rect, int fontHeight, Color c) { Font f = new Font("Serif", Font.PLAIN, fontHeight); g.setFont(f);//from w w w . j av a2 s. c om g.setColor(c); g.drawString(text, rect.x, rect.y + rect.height); } public static void drawStringLeft(Graphics2D g, String text, int x, int y, int fontHeight, Color c) { drawStringLeft(g, text, x, y, fontHeight, c, false); } public static void drawStringLeft(Graphics2D g, String text, int x, int y, int fontHeight, Color c, boolean bold) { Font f = new Font("Serif", bold ? Font.BOLD : Font.PLAIN, fontHeight); g.setFont(f); g.setColor(c); g.drawString(text, x, y); } }