Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import javax.swing.JComponent;

public class Main {
    public static FontMetrics getFontMetrics(JComponent c, Graphics g) {
        Font font = g.getFont();
        if (c != null) {
            return c.getFontMetrics(g.getFont());
        }
        return g.getFontMetrics(font);
    }
}