Java Swing UI Thread Event edtSmartInvokeAndWait(Runnable block)

Here you can find the source of edtSmartInvokeAndWait(Runnable block)

Description

edt Smart Invoke And Wait

License

Open Source License

Declaration

public static void edtSmartInvokeAndWait(Runnable block) 

Method Source Code

//package com.java2s;
// Copyright 2011-2012 Paulo Augusto Peccin. See licence.txt distributed with this file.

import java.lang.reflect.InvocationTargetException;

import javax.swing.SwingUtilities;

public class Main {
    public static void edtSmartInvokeAndWait(Runnable block) {
        if (!SwingUtilities.isEventDispatchThread())
            try {
                SwingUtilities.invokeAndWait(block);
            } catch (InterruptedException e) {
            } catch (InvocationTargetException e) {
            }/* w  ww.  ja v a  2  s.c o  m*/
        else
            block.run();
    }
}

Related

  1. doLaterOnEventThread(Runnable task)
  2. doOnEventThreadAndWait(Runnable task)
  3. doSwing(Runnable r)
  4. edtExecutor()
  5. edtInvokeLater(Runnable block)
  6. execute(Runnable command)
  7. executeInSwingThread(final Runnable code)
  8. executeRunnable(Runnable runnable)
  9. executeTask(final Runnable task, final boolean async)