1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57: import ;
58: import ;
59: import ;
60: import ;
61: import ;
62: import ;
63: import ;
64: import ;
65: import ;
66: import ;
67:
68:
75:
76:
85: public class GLightweightPeer
86: implements LightweightPeer, ContainerPeer
87: {
88: private Component comp;
89:
90: private Insets containerInsets;
91:
92: public GLightweightPeer(Component comp)
93: {
94: this.comp = comp;
95: }
96:
97:
98:
99: public Insets insets()
100: {
101: return getInsets ();
102: }
103:
104: public Insets getInsets()
105: {
106: if (containerInsets == null)
107: containerInsets = new Insets (0,0,0,0);
108: return containerInsets;
109: }
110:
111: public void beginValidate()
112: {
113: }
114:
115: public void endValidate()
116: {
117: }
118:
119: public void beginLayout()
120: {
121: }
122:
123: public void endLayout()
124: {
125: }
126:
127: public boolean isPaintPending()
128: {
129: return false;
130: }
131:
132:
133:
134: public int checkImage(Image img, int width, int height, ImageObserver o)
135: {
136: return comp.getToolkit().checkImage(img, width, height, o);
137: }
138:
139: public Image createImage(ImageProducer prod)
140: {
141: return comp.getToolkit().createImage(prod);
142: }
143:
144:
145: public Image createImage(int width, int height)
146: {
147: return null;
148: }
149:
150: public void disable() {}
151:
152: public void dispose() {}
153:
154: public void enable() {}
155:
156: public GraphicsConfiguration getGraphicsConfiguration()
157: {
158: return null;
159: }
160:
161: public FontMetrics getFontMetrics(Font f)
162: {
163: return comp.getToolkit().getFontMetrics(f);
164: }
165:
166:
168: public Graphics getGraphics()
169: {
170: return null;
171: }
172:
173: public Point getLocationOnScreen()
174: {
175: Point parentLocation = comp.getParent().getLocationOnScreen();
176: return new Point (parentLocation.x + comp.getX(),
177: parentLocation.y + comp.getY());
178: }
179:
180: public Dimension getMinimumSize()
181: {
182: return new Dimension(comp.getWidth(), comp.getHeight());
183: }
184:
185:
187: public Dimension getPreferredSize()
188: {
189: return new Dimension(comp.getWidth(), comp.getHeight());
190: }
191:
192:
194: public Toolkit getToolkit()
195: {
196: return null;
197: }
198:
199: public void handleEvent(AWTEvent e) {}
200:
201: public void hide() {}
202:
203: public boolean isFocusable()
204: {
205: return false;
206: }
207:
208: public boolean isFocusTraversable()
209: {
210: return false;
211: }
212:
213: public Dimension minimumSize()
214: {
215: return getMinimumSize();
216: }
217:
218: public Dimension preferredSize()
219: {
220: return getPreferredSize();
221: }
222:
223: public void paint(Graphics graphics) {}
224:
225: public boolean prepareImage(Image img, int width, int height,
226: ImageObserver o)
227: {
228: return comp.getToolkit().prepareImage(img, width, height, o);
229: }
230:
231: public void print(Graphics graphics) {}
232:
233: public void repaint(long tm, int x, int y, int width, int height)
234: {
235: Component p = comp.getParent();
236: if (p != null)
237: p.repaint(tm, x + comp.getX(), y + comp.getY(), width, height);
238: }
239:
240: public void requestFocus() {}
241:
242: public boolean requestFocus(Component source, boolean bool1, boolean bool2, long x)
243: {
244: return false;
245: }
246:
247: public void reshape(int x, int y, int width, int height) {}
248:
249: public void setBackground(Color color) {}
250:
251: public void setBounds(int x, int y, int width, int height) {}
252:
253:
257: public void setCursor(Cursor cursor)
258: {
259: Component p = comp.getParent();
260: while (p != null && p.isLightweight())
261: p = p.getParent();
262:
263: if (p != null)
264: {
265:
266:
267: ComponentPeer peer = p.getPeer();
268: if (peer != null)
269: peer.setCursor(cursor);
270: }
271: }
272:
273: public void setEnabled(boolean enabled) {}
274:
275: public void setEventMask(long eventMask) {}
276:
277: public void setFont(Font font) {}
278:
279: public void setForeground(Color color) {}
280:
281: public void setVisible(boolean visible) {}
282:
283: public void show() {}
284:
285: public ColorModel getColorModel ()
286: {
287: return comp.getColorModel ();
288: }
289:
290: public boolean isObscured()
291: {
292: return false;
293: }
294:
295: public boolean canDetermineObscurity()
296: {
297: return false;
298: }
299:
300: public void coalescePaintEvent(PaintEvent e) { }
301:
302: public void updateCursorImmediately() { }
303:
304: public VolatileImage createVolatileImage(int width, int height)
305: {
306: return null;
307: }
308:
309: public boolean handlesWheelScrolling()
310: {
311: return false;
312: }
313:
314: public void createBuffers(int x, BufferCapabilities capabilities)
315: throws AWTException { }
316:
317: public Image getBackBuffer()
318: {
319: return null;
320: }
321:
322: public void flip(BufferCapabilities.FlipContents contents) { }
323:
324: public void destroyBuffers() { }
325:
326: public boolean isRestackSupported()
327: {
328: return false;
329: }
330:
331: public void cancelPendingPaint(int x, int y, int width, int height)
332: {
333:
334: }
335:
336: public void restack()
337: {
338:
339: }
340:
341: public Rectangle getBounds()
342: {
343: return null;
344: }
345:
346: public void reparent(ContainerPeer parent)
347: {
348:
349: }
350:
351: public void setBounds(int x, int y, int z, int width, int height)
352: {
353:
354: }
355:
356: public boolean isReparentSupported()
357: {
358: return false;
359: }
360:
361: public void layout()
362: {
363:
364: }
365: }