Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Window;
import javax.swing.SwingUtilities;

public class Main {
    public static void showWindow(final Window window, boolean modal) {
        Runnable r = new Runnable() {
            public void run() {
                window.pack();
                window.setVisible(true);
            }
        };

        if (modal) {
            try {
                SwingUtilities.invokeAndWait(r);
                window.dispose();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            SwingUtilities.invokeLater(r);
        }
    }
}