Java Swing Font Height getFontHeight(JComponent component)

Here you can find the source of getFontHeight(JComponent component)

Description

get Font Height

License

Open Source License

Declaration

public static int getFontHeight(JComponent component) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;
import java.awt.*;

public class Main {
    public static int getFontHeight(JComponent component) {
        return getFontHeight(component, component.getFont());
    }//from  w w  w . ja  v  a  2 s  .c o  m

    public static int getFontHeight(JComponent component, Font font) {
        return component == null ? -1 : component.getFontMetrics(font).getHeight();
    }
}

Related

  1. drawString(Graphics g, Font font, String text, int x, int y, int width, int height, int align)
  2. getFontHeight(JComponent comp)
  3. getLabelFontHeight()