1:
8:
9: package ;
10:
11: import ;
12: import ;
13: import ;
14: import ;
15: import ;
16: import ;
17: import ;
18:
19:
23: public class XEventQueue extends EventQueue
24: {
25: Display display;
26:
27: public XEventQueue(Display display)
28: {
29: this.display = display;
30: }
31:
32: public AWTEvent getNextEvent() throws InterruptedException
33: {
34: if ((peekEvent() == null) && (display != null))
35: display.flush();
36: AWTEvent event = super.getNextEvent();
37: if (event != null)
38: {
39: switch (event.getID ())
40: {
41: case ContainerEvent.COMPONENT_ADDED:
42: {
43:
50: ContainerEvent ce = (ContainerEvent)event;
51: ce.getChild ().invalidate ();
52: ce.getContainer ().validate ();
53: }
54: break;
55:
56: case ComponentEvent.COMPONENT_RESIZED:
57: {
58: ComponentEvent ce = (ComponentEvent)event;
59:
60: ce.getComponent ().validate ();
61: }
62: break;
63:
64: case ComponentEvent.COMPONENT_SHOWN:
65: {
66: ComponentEvent ce = (ComponentEvent)event;
67: Component comp = ce.getComponent ();
68: if (!comp.isValid ())
69: {
70:
74: Container parent = comp.getParent ();
75: while (parent != null)
76: {
77: Container next = parent.getParent ();
78: if (next == null || next.isValid ())
79: {
80: parent.validate ();
81: break;
82: }
83: else
84: parent = next;
85: }
86: if (comp instanceof Container)
87: comp.validate ();
88: }
89: comp.repaint ();
90: }
91: break;
92:
93: default:
94: break;
95: }
96: }
97: return event;
98: }
99: }