Java Font Text Height getTextHeight(String text, Graphics g, String newLineSplit)

Here you can find the source of getTextHeight(String text, Graphics g, String newLineSplit)

Description

get Text Height

License

Open Source License

Declaration

public static int getTextHeight(String text, Graphics g, String newLineSplit) 

Method Source Code


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

import java.awt.Graphics;

public class Main {
    public static int getTextHeight(String text, Graphics g, String newLineSplit) {
        return g.getFontMetrics().getHeight() * text.split(newLineSplit).length;
    }/*from   ww w. j  a  va  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 s, FontMetrics fm, Graphics g)
  6. stringHeight(Graphics2D g2d)