Java Font Text Height getTextHeight(String s, FontMetrics fm, Graphics g)

Here you can find the source of getTextHeight(String s, FontMetrics fm, Graphics g)

Description

get Text Height

License

Open Source License

Declaration

public static int getTextHeight(String s, FontMetrics fm, Graphics g) 

Method Source Code


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

import java.awt.FontMetrics;
import java.awt.Graphics;

public class Main {
    public static int getTextHeight(String s, FontMetrics fm, Graphics g) {
        return (int) Math.ceil(fm.getLineMetrics(s, g).getHeight());
    }/*from w  ww.  jav  a  2 s. c  o m*/
}

Related

  1. getStringDrawingHeight(Graphics graphics, String string)
  2. getStringHeight(Component c)
  3. getStringHeight(Graphics2D g, String str)
  4. getStringHeight(Graphics2D graphics2D)
  5. getTextHeight(String text, Graphics g, String newLineSplit)
  6. stringHeight(Graphics2D g2d)