// Determining if you are on the EDT thread
// Either method will work in Java version 1.3 or later
// to determine if you are running on the dispatch thread,
// the same for AWT or Swing.

// in Swing
final boolean onSwingThread = javax.swing.SwingUtilities.isEventDispatchThread();

// in AWT
final boolean onDispatchThread = java.awt.EventQueue.isDispatchThread();

// Dump info about the current thread, name, priority, group.
out.println( Thread.currentThread() );

// Dump name of the current thread
out.println( Thread.currentThread().getName() );