Java Swing UI Thread Event throwIfNotOnEDT()

Here you can find the source of throwIfNotOnEDT()

Description

throw If Not On EDT

License

Open Source License

Declaration

static void throwIfNotOnEDT() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Open Door Logistics (www.opendoorlogistics.com)
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v3
 * which accompanies this distribution, and is available at http://www.gnu.org/licenses/lgpl.txt
 ******************************************************************************/

import javax.swing.SwingUtilities;

public class Main {
    static void throwIfNotOnEDT() {
        // must be on EDT
        if (!SwingUtilities.isEventDispatchThread()) {
            throw new RuntimeException();
        }//from  w  w  w  . j  ava2  s .c o  m
    }
}

Related

  1. runTimer(int duration, final Runnable run)
  2. safeGUIRun(Runnable runnable)
  3. safelyRunBlockingRoutine(Runnable runnable)
  4. safeSwingCall(@Nonnull final Runnable runnable)
  5. saveInvokeAndWait(Runnable run)
  6. toEDT(Runnable r, boolean wait)
  7. waitOnEDT(Runnable r)