MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class MainClass extends JFrame {

    public MainClass(String title) {
        super(title);
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        final JDesktopPane desk = new JDesktopPane();
        setContentPane(desk);

        JOptionPane.showInternalInputDialog(desk, "Enter Name");
    }

    // A simple test program
    public static void main(String[] args) {
        MainClass td = new MainClass("Desktop");
        td.setSize(350, 250);
        td.setVisible(true);
    }
}