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

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

// in AWT
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() );