GettingFontMetrics.java Source code

Java tutorial

Introduction

Here is the source code for GettingFontMetrics.java

Source

import java.awt.FontMetrics;

import javax.swing.JFrame;

public class GettingFontMetrics {
    public static void main(String args[]) {
        JFrame f = new JFrame("JColorChooser Sample");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        FontMetrics metrics = f.getFontMetrics(f.getFont());

        f.setSize(300, 200);
        f.setVisible(true);
    }
}