TrueTypeTest.java Source code

Java tutorial

Introduction

Here is the source code for TrueTypeTest.java

Source

import java.awt.Font;
import java.awt.GraphicsEnvironment;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class TrueTypeTest extends JFrame {

    private String textMessage = "Java Internationalization";

    public TrueTypeTest() {
        super("TrueType Font Demonstration");

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        ge.getAllFonts();

        Font font = new Font("Jokerman", Font.PLAIN, 35);
        JLabel textLabel = new JLabel(textMessage);
        textLabel.setFont(font);

        getContentPane().add(textLabel);
        show();
    }

    public static void main(String[] args) {
        JFrame frame = new TrueTypeTest();
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        frame.pack();
        frame.setVisible(true);
    }
}