1 7 8 package java.awt; 9 10 import java.awt.AWTEvent ; 11 import java.awt.ActiveEvent ; 12 import sun.awt.AppContext; 13 import sun.awt.SunToolkit; 14 15 24 class SentEvent extends AWTEvent implements ActiveEvent { 25 static final int ID = 26 java.awt.event.FocusEvent.FOCUS_LAST + 2; 27 28 boolean dispatched; 29 private AWTEvent nested; 30 private AppContext toNotify; 31 32 SentEvent() { 33 this(null); 34 } 35 SentEvent(AWTEvent nested) { 36 this(nested, null); 37 } 38 SentEvent(AWTEvent nested, AppContext toNotify) { 39 super((nested != null) 40 ? nested.getSource() 41 : Toolkit.getDefaultToolkit(), 42 ID); 43 this.nested = nested; 44 this.toNotify = toNotify; 45 } 46 47 public void dispatch() { 48 try { 49 if (nested != null) { 50 Toolkit.getEventQueue().dispatchEvent(nested); 51 } 52 } finally { 53 dispatched = true; 54 if (toNotify != null) { 55 SunToolkit.postEvent(toNotify, new SentEvent ()); 56 } 57 synchronized (this) { 58 notifyAll(); 59 } 60 } 61 } 62 final void dispose() { 63 dispatched = true; 64 if (toNotify != null) { 65 SunToolkit.postEvent(toNotify, new SentEvent ()); 66 } 67 synchronized (this) { 68 notifyAll(); 69 } 70 } 71 } 72 | Popular Tags |