Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Karlsruhe Institute of Technology, Germany * Technical University Darmstadt, Germany * Chalmers University of Technology, Sweden * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Technical University Darmstadt - initial API and implementation and/or initial documentation *******************************************************************************/ import javax.swing.SwingUtilities; public class Main { /** * Checks if the currently active {@link Thread} is responsible * for the Swing UI. * @return {@code true} is Swing {@link Thread}, {@code false} is not Swing {@link Thread}. */ public static boolean isSwingThread() { return SwingUtilities.isEventDispatchThread(); } }