Java tutorial
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { /** * @return Returns <code>true</code> if the frame is visible, showing and not * iconified. */ public static boolean isVisibleNotMinimized(JFrame frame) { assertEventDispatcherThread(); return (frame.isVisible() && frame.isShowing() && (frame.getExtendedState() & JFrame.ICONIFIED) == 0); } /** * Assert we are in the event dispatching thread. */ public static void assertEventDispatcherThread() { if (!SwingUtilities.isEventDispatchThread()) throw new IllegalStateException("Not an AWT thread."); } }