Here you can find the source of invokeLater(Runnable runnable, boolean forceLater)
forceLater
parameter.
Parameter | Description |
---|---|
forceLater | Force execution of runnable to be delayed<br> even if we are on the AWT event dispatching thread |
public static void invokeLater(Runnable runnable, boolean forceLater)
//package com.java2s; /*/*from w ww . ja v a 2s . c om*/ * Copyright 2010, 2011 Institut Pasteur. * * This file is part of ICY. * * ICY is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ICY is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ICY. If not, see <http://www.gnu.org/licenses/>. */ import javax.swing.SwingUtilities; public class Main { /** * Invoke "runnable" on the AWT event dispatching thread.<br> * If you are in the AWT event dispatching thread the runnable is executed immediately. */ public static void invokeLater(Runnable runnable) { invokeLater(runnable, false); } /** * Invoke "runnable" on the AWT event dispatching thread.<br> * If you are in the AWT event dispatching thread the runnable can be executed immediately<br> * depending the value of <code>forceLater</code> parameter. * * @param forceLater * Force execution of runnable to be delayed<br> * even if we are on the AWT event dispatching thread */ public static void invokeLater(Runnable runnable, boolean forceLater) { if (SwingUtilities.isEventDispatchThread() && !forceLater) runnable.run(); else SwingUtilities.invokeLater(runnable); } }