OSDN Git Service

* java/awt/Component.java (toString): Implemented.
[pf3gnuchains/gcc-fork.git] / libjava / java / awt / EventDispatchThread.java
1 /* Copyright (C) 2000  Free Software Foundation
2
3    This file is part of libgcj.
4
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7 details.  */
8
9 /** @author Bryce McKinlay */
10
11 /* Status: believed complete, but untested. */
12
13 package java.awt;
14
15 class EventDispatchThread extends Thread
16 {
17   private static int dispatchThreadNum = 1;
18
19   private EventQueue queue;
20
21   EventDispatchThread(EventQueue queue)
22   {
23     super();
24     setName("AWT-EventQueue-" + dispatchThreadNum++);
25     this.queue = queue;
26     setPriority(NORM_PRIORITY + 1);
27   }
28
29   public void run()
30   {
31     while (true)
32       {
33         try
34         {
35           AWTEvent evt = queue.getNextEvent();
36           queue.dispatchEvent(evt);
37         }
38         catch (Throwable x)
39         {
40           System.err.println("Exception during event dispatch:");
41           x.printStackTrace(System.err);
42         }
43       }
44   }
45 }