Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.*;

public class Main {
    /**
     * Get the string height in the context of Graphics.
     * 
     * @param g
     *            The <code>Graphics</code>.
     * @return The height <code>int</code>.
     */
    public static int getStringHeight(final Graphics g) {
        final FontMetrics fontMetrics = g.getFontMetrics();
        return fontMetrics.getMaxAscent() + fontMetrics.getMaxDescent();
    }
}