Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JDialog;

public class Main extends JDialog {

    public Main() {
        setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.out.println("closing...");
            }
        });
    }

    public static void main(String[] args) {
        Main m = new Main();
        m.setVisible(true);
    }
}