home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 1.6 KB | 61 lines |
- /*
- * @(#)EventDispatchThread.java 1.18 98/03/18
- *
- * Copyright 1996, 1997 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
- package java.awt;
-
- /**
- * EventDispatchThread is a package-private AWT class which takes
- * events off the EventQueue and dispatches them to the appropriate
- * AWT components.
- *
- * @version 1.18 03/18/98
- * @author Tom Ball
- * @author Amy Fowler
- */
- class EventDispatchThread extends Thread {
- private EventQueue theQueue;
- private boolean doDispatch = true;
-
- EventDispatchThread(String name, EventQueue queue) {
- super(name);
- theQueue = queue;
- }
-
- public void stopDispatching() {
- doDispatch = false;
- }
-
- public void run() {
- while (doDispatch) {
- try {
- AWTEvent event = theQueue.getNextEvent();
- theQueue.dispatchEvent(event);
- } catch (ThreadDeath death) {
- return;
-
- } catch (Throwable e) {
- System.err.println(
- "Exception occurred during event dispatching:");
- e.printStackTrace();
- }
- }
- }
-
- boolean isDispatching(EventQueue eq) {
- return theQueue.equals(eq);
- }
-
- EventQueue getEventQueue() { return theQueue; }
- }
-