01: package tijmp;
02:
03: import java.util.concurrent.LinkedBlockingQueue;
04:
05: /* Our own event handler.
06: * Since we do not know if the security manager will grant random
07: * threads access to create new threads we need our own thread running so
08: * that we do not hog the edt.
09: * This thread is started very early so it has no security set.
10: */
11: class EventHandler implements Runnable {
12: private static LinkedBlockingQueue<Runnable> lbq;
13:
14: public EventHandler(LinkedBlockingQueue<Runnable> lbq) {
15: this .lbq = lbq;
16: }
17:
18: public void run() {
19: while (true) {
20: try {
21: Runnable r = lbq.take();
22: r.run();
23: } catch (InterruptedException e) {
24: e.printStackTrace();
25: }
26: }
27: }
28: }
|