Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Dimension;
import java.awt.FontMetrics;

import javax.swing.JComponent;

import sun.swing.SwingUtilities2;

public class Main {
    public static Dimension getStringSize(JComponent c, FontMetrics metrics, String text) {
        int width = SwingUtilities2.stringWidth(c, metrics, text);
        int height = metrics.getHeight();
        return new Dimension(width, height);
    }
}