Here you can find the source of stringHeight(Graphics2D g2d)
public static int stringHeight(Graphics2D g2d)
//package com.java2s; //License from project: Open Source License import java.awt.FontMetrics; import java.awt.Graphics2D; public class Main { public static int stringHeight(Graphics2D g2d) { FontMetrics fm = g2d.getFontMetrics(g2d.getFont()); return fm.getHeight(); }// w w w . j av a 2 s. co m }