Here you can find the source of invokeOnEventThread(Runnable runnable)
Parameter | Description |
---|---|
runnable | a parameter |
public static void invokeOnEventThread(Runnable runnable)
//package com.java2s; /*/*from ww w . j a va 2 s . c om*/ * Copyright (c) 2007-2012 The Broad Institute, Inc. * SOFTWARE COPYRIGHT NOTICE * This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved. * * This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality. * * This software is licensed under the terms of the GNU Lesser General Public License (LGPL), * Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php. */ import javax.swing.*; public class Main { /** * A wrapper around invokeOnEventThread. If the runnable is already in the event dispatching * queue it is just run. Otherwise it is placed in the queue via invokeOnEventThread. * <p/> * I'm not sure this is strictly necessary, but is safe. * * @param runnable */ public static void invokeOnEventThread(Runnable runnable) { if (SwingUtilities.isEventDispatchThread()) { runnable.run(); } else { SwingUtilities.invokeLater(runnable); } } }