Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

public class Main extends JFrame {

    private String textMessage = "Java Internationalization";

    public Main() {
        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);
        setVisible(true);
    }

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

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