Java FontMetrics getLineHeight(Component c, int defaultHeight)

Here you can find the source of getLineHeight(Component c, int defaultHeight)

Description

get Line Height

License

Open Source License

Declaration

public static int getLineHeight(Component c,
                int defaultHeight)
        

Method Source Code

//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;
        /*      */}
}

Related

  1. getAllStylesSameWidthsFontsFamillyName()
  2. getCenterOffset(Graphics g, Font f, char ch)
  3. getComponentAverageCharacterWidth(Component component)
  4. getConsoleFontMetrics(Font font)
  5. getLineBreakIndex(Graphics g, String text, int index, double maxWidth)
  6. getLineHeight(Component c, int defaultHeight)
  7. getLineHeight(Component component, int count)
  8. getLineHeight(FontMetrics fm)
  9. getLongestStringWidth(FontMetrics fm, String[] theStrings)