private static synchronized void startEventDispatchThreadIfNecessary(){
  if (eventDispatchThread == null) {
    eventDispatchThread=new EventDispatchThread();
    eventDispatchThread.setDaemon(true);
    eventDispatchThread.start();
  }
}

private static synchronized void startEventDispatchThreadIfNecessary ( ) { if ( eventDispatchThread == null ) { eventDispatchThread = new EventDispatchThread ( ) ; eventDispatchThread . setDaemon ( true ) ; eventDispatchThread . start ( ) ; } }
this method starts the event dispatch thread the first time it is called . the event dispatch thread will be started only if someone registers a listener .
