Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Color;
import java.awt.Font;

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

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame("JLabel Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JLabel label = new JLabel("First Name");
        label.setFont(new Font("Courier New", Font.ITALIC, 18));
        label.setForeground(Color.RED);

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