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 java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

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

public class Main extends JFrame {

    public Main() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JLabel label = new JLabel("Some label text");
        label.setBorder(BorderFactory.createLineBorder(Color.green));
        label.setFont(new Font("Serif", Font.ITALIC, 16));

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

    public static void main(String arg[]) {
        new Main();
    }
}