Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import javax.swing.JFrame;

public class Main {
    /**
     * create JFrame that has a WindowListener object that was invoked
     * System.exit(0) by pushing close button.
     */
    public static JFrame getTestFrame(String title) {
        JFrame f = new JFrame(title);
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        return f;
    }
}