src/java.desktop/share/classes/java/awt/EventDispatchThread.java

Print this page




  26 package java.awt;
  27 
  28 import java.awt.event.MouseEvent;
  29 import java.awt.event.ActionEvent;
  30 import java.awt.event.WindowEvent;
  31 
  32 import java.util.ArrayList;
  33 import sun.util.logging.PlatformLogger;
  34 
  35 import sun.awt.dnd.SunDragSourceContextPeer;
  36 
  37 /**
  38  * EventDispatchThread is a package-private AWT class which takes
  39  * events off the EventQueue and dispatches them to the appropriate
  40  * AWT components.
  41  *
  42  * The Thread starts a "permanent" event pump with a call to
  43  * pumpEvents(Conditional) in its run() method. Event handlers can choose to
  44  * block this event pump at any time, but should start a new pump (<b>not</b>
  45  * a new EventDispatchThread) by again calling pumpEvents(Conditional). This
  46  * secondary event pump will exit automatically as soon as the Condtional
  47  * evaluate()s to false and an additional Event is pumped and dispatched.
  48  *
  49  * @author Tom Ball
  50  * @author Amy Fowler
  51  * @author Fred Ecks
  52  * @author David Mendenhall
  53  *
  54  * @since 1.1
  55  */
  56 class EventDispatchThread extends Thread {
  57 
  58     private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread");
  59 
  60     private EventQueue theQueue;
  61     private volatile boolean doDispatch = true;
  62 
  63     private static final int ANY_EVENT = -1;
  64 
  65     private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>();
  66 




  26 package java.awt;
  27 
  28 import java.awt.event.MouseEvent;
  29 import java.awt.event.ActionEvent;
  30 import java.awt.event.WindowEvent;
  31 
  32 import java.util.ArrayList;
  33 import sun.util.logging.PlatformLogger;
  34 
  35 import sun.awt.dnd.SunDragSourceContextPeer;
  36 
  37 /**
  38  * EventDispatchThread is a package-private AWT class which takes
  39  * events off the EventQueue and dispatches them to the appropriate
  40  * AWT components.
  41  *
  42  * The Thread starts a "permanent" event pump with a call to
  43  * pumpEvents(Conditional) in its run() method. Event handlers can choose to
  44  * block this event pump at any time, but should start a new pump (<b>not</b>
  45  * a new EventDispatchThread) by again calling pumpEvents(Conditional). This
  46  * secondary event pump will exit automatically as soon as the Conditional
  47  * evaluate()s to false and an additional Event is pumped and dispatched.
  48  *
  49  * @author Tom Ball
  50  * @author Amy Fowler
  51  * @author Fred Ecks
  52  * @author David Mendenhall
  53  *
  54  * @since 1.1
  55  */
  56 class EventDispatchThread extends Thread {
  57 
  58     private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread");
  59 
  60     private EventQueue theQueue;
  61     private volatile boolean doDispatch = true;
  62 
  63     private static final int ANY_EVENT = -1;
  64 
  65     private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>();
  66