Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.EventQueue;
import java.lang.reflect.InvocationTargetException;

public class Main {
    public static void invokeAndWait(final Runnable doRun) {
        if (doRun == null) {
            throw new IllegalArgumentException("The runnable cannot be null");
        }
        if (EventQueue.isDispatchThread()) {
            doRun.run();
        } else {
            try {
                EventQueue.invokeAndWait(doRun);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }
        }
    }
}