Java tutorial
//package com.java2s; //License from project: Apache License import javax.swing.SwingUtilities; public class Main { static boolean isEventDispatchThread() { try { return SwingUtilities.isEventDispatchThread(); } catch (final NullPointerException e) { return false; } } }