/** * ** Queues the invocation of the specified Runnable on the EventQueue, and waits for the * EventQueue ** thread to complete execution of the specified Runnable. ** @param r The Runnable * to execute */ public static void invokeAndWait(Runnable r) throws InterruptedException, InvocationTargetException { if (r != null) { // call from a child thread only! (will block otherwise) // Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(r); EventQueue.invokeAndWait(r); } }
public static void main(String[] args) { EventQueue.invokeLater( new Runnable() { public void run() { JFrame frame = new ObjectInspectorFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); }
/** * ** Returns true if the calling Thread is the event dispatch thread ** @return True if the * calling Thread is the event dispatch thread */ public static boolean isDispatchThread() { return EventQueue.isDispatchThread(); }
/** * ** Queues the invocation of the specified Runnable on the EventQueue ** @param r The Runnable * to execute */ public static void invokeLater(Runnable r) { if (r != null) { // Toolkit.getDefaultToolkit().getSystemEventQueue().invokeLater(r); EventQueue.invokeLater(r); } }