Java Swing UI Thread Event invokeAndWait(Runnable task)

Here you can find the source of invokeAndWait(Runnable task)

Description

invoke And Wait

License

Apache License

Declaration

static void invokeAndWait(Runnable task) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.SwingUtilities;

public class Main {
    static void invokeAndWait(Runnable task) {
        if (SwingUtilities.isEventDispatchThread()) {
            task.run();//  w  w w . j  a  va2 s. c o m
        } else {
            try {
                SwingUtilities.invokeAndWait(task);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}

Related

  1. invoke(Runnable runnable)
  2. invoke(Runnable runnable)
  3. invokeAfter(final Runnable execute, int after)
  4. invokeAndContiune(Runnable runnable)
  5. invokeAndWait(final Runnable r)
  6. invokeAndWaitAsNeeded(Runnable r)
  7. invokeAndWaitEDT(final Runnable runnable)
  8. invokeAndWaitFromAnyThread(Runnable r)
  9. invokeAndWaitSafely(final Runnable runnable)