Here you can find the source of getLineHeight(Component c, int defaultHeight)
public static int getLineHeight(Component c, int defaultHeight)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import java.awt.Font; import java.awt.FontMetrics; public class Main { public static int getLineHeight(Component c, int defaultHeight) /* */{//from w w w. j av a 2 s. c om /* 3619 */Font f = c == null ? null : c.getFont(); /* 3620 */if (f == null) { /* 3621 */return defaultHeight; /* */} /* 3623 */FontMetrics fm = c.getFontMetrics(f); /* 3624 */float h = fm.getHeight(); /* */ /* 3626 */h += fm.getDescent(); /* */ /* 3628 */return (int) h; /* */} }