// 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 (Advanced Windowing Toolkit) 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.getName() );