Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JDialog;
import javax.swing.JFrame;

public class Main {
    JFrame frame = new JFrame();
    JDialog dialog = new JDialog();

    public Main() {
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 300);
        frame.setVisible(true);
        dialog = new JDialog(frame, true);
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dialog.setModal(true);
        dialog.setSize(300, 200);
        dialog.setVisible(true);
    }

    public static void main(String args[]) {
        Main dialog = new Main();
    }
}