author | mchung |
Tue, 29 Sep 2009 16:03:03 -0700 | |
changeset 3938 | ef327bd847c0 |
parent 2459 | 08f3416ff334 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package sun.awt; |
|
27 |
||
28 |
import java.awt.Component; |
|
29 |
import java.awt.Container; |
|
30 |
import java.awt.AWTEvent; |
|
31 |
import java.awt.Font; |
|
32 |
import java.awt.Color; |
|
33 |
import java.awt.Cursor; |
|
34 |
import java.awt.Point; |
|
35 |
||
36 |
import java.awt.peer.ComponentPeer; |
|
37 |
||
38 |
import java.lang.reflect.Field; |
|
39 |
import java.lang.reflect.Method; |
|
40 |
import java.lang.reflect.InvocationTargetException; |
|
41 |
||
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
42 |
import sun.util.logging.PlatformLogger; |
2 | 43 |
|
44 |
import java.security.AccessController; |
|
45 |
import java.security.PrivilegedAction; |
|
46 |
||
47 |
/** |
|
48 |
* A collection of methods for modifying package private fields in AWT components. |
|
49 |
* This class is meant to be used by Peer code only. Previously peer code |
|
50 |
* got around this problem by modifying fields from native code. However |
|
51 |
* as we move away from native code to Pure-java peers we need this class. |
|
52 |
* |
|
53 |
* @author Bino George |
|
54 |
*/ |
|
55 |
||
56 |
||
57 |
public class ComponentAccessor |
|
58 |
{ |
|
59 |
private static Class componentClass; |
|
60 |
private static Field fieldX; |
|
61 |
private static Field fieldY; |
|
62 |
private static Field fieldWidth; |
|
63 |
private static Field fieldHeight; |
|
64 |
private static Method methodGetParentNoClientCode; |
|
65 |
private static Method methodGetFontNoClientCode; |
|
66 |
private static Method methodProcessEvent; |
|
67 |
private static Method methodEnableEvents; |
|
68 |
private static Field fieldParent; |
|
69 |
private static Field fieldBackground; |
|
70 |
private static Field fieldForeground; |
|
71 |
private static Field fieldFont; |
|
72 |
private static Field fieldPacked; |
|
73 |
private static Field fieldIgnoreRepaint; |
|
74 |
private static Field fieldPeer; |
|
75 |
private static Field fieldVisible; |
|
76 |
private static Method methodIsEnabledImpl; |
|
77 |
private static Method methodGetCursorNoClientCode; |
|
78 |
private static Method methodLocationNoClientCode; |
|
79 |
||
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
80 |
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.ComponentAccessor"); |
2 | 81 |
|
82 |
private ComponentAccessor() { |
|
83 |
} |
|
84 |
||
85 |
static { |
|
86 |
AccessController.doPrivileged( new PrivilegedAction() { |
|
87 |
public Object run() { |
|
88 |
try { |
|
89 |
componentClass = Class.forName("java.awt.Component"); |
|
90 |
fieldX = componentClass.getDeclaredField("x"); |
|
91 |
fieldX.setAccessible(true); |
|
92 |
fieldY = componentClass.getDeclaredField("y"); |
|
93 |
fieldY.setAccessible(true); |
|
94 |
fieldWidth = componentClass.getDeclaredField("width"); |
|
95 |
fieldWidth.setAccessible(true); |
|
96 |
fieldHeight = componentClass.getDeclaredField("height"); |
|
97 |
fieldHeight.setAccessible(true); |
|
98 |
fieldForeground = componentClass.getDeclaredField("foreground"); |
|
99 |
fieldForeground.setAccessible(true); |
|
100 |
fieldBackground = componentClass.getDeclaredField("background"); |
|
101 |
fieldBackground.setAccessible(true); |
|
102 |
fieldFont = componentClass.getDeclaredField("font"); |
|
103 |
fieldFont.setAccessible(true); |
|
104 |
methodGetParentNoClientCode = componentClass.getDeclaredMethod("getParent_NoClientCode", (Class[]) null); |
|
105 |
methodGetParentNoClientCode.setAccessible(true); |
|
106 |
methodGetFontNoClientCode = componentClass.getDeclaredMethod("getFont_NoClientCode", (Class[]) null); |
|
107 |
methodGetFontNoClientCode.setAccessible(true); |
|
108 |
Class[] argTypes = { AWTEvent.class }; |
|
109 |
methodProcessEvent = componentClass.getDeclaredMethod("processEvent",argTypes); |
|
110 |
methodProcessEvent.setAccessible(true); |
|
111 |
Class[] argTypesForMethodEnableEvents = { Long.TYPE }; |
|
112 |
methodEnableEvents = componentClass.getDeclaredMethod("enableEvents",argTypesForMethodEnableEvents); |
|
113 |
methodEnableEvents.setAccessible(true); |
|
114 |
||
115 |
fieldParent = componentClass.getDeclaredField("parent"); |
|
116 |
fieldParent.setAccessible(true); |
|
117 |
fieldPacked = componentClass.getDeclaredField("isPacked"); |
|
118 |
fieldPacked.setAccessible(true); |
|
119 |
fieldIgnoreRepaint = componentClass.getDeclaredField("ignoreRepaint"); |
|
120 |
fieldIgnoreRepaint.setAccessible(true); |
|
121 |
||
122 |
fieldPeer = componentClass.getDeclaredField("peer"); |
|
123 |
fieldPeer.setAccessible(true); |
|
124 |
||
125 |
fieldVisible = componentClass.getDeclaredField("visible"); |
|
126 |
fieldVisible.setAccessible(true); |
|
127 |
||
128 |
methodIsEnabledImpl = componentClass.getDeclaredMethod("isEnabledImpl", (Class[]) null); |
|
129 |
methodIsEnabledImpl.setAccessible(true); |
|
130 |
||
131 |
methodGetCursorNoClientCode = componentClass.getDeclaredMethod("getCursor_NoClientCode", (Class[]) null); |
|
132 |
methodGetCursorNoClientCode.setAccessible(true); |
|
133 |
||
134 |
methodLocationNoClientCode = componentClass.getDeclaredMethod("location_NoClientCode", (Class[]) null); |
|
135 |
methodLocationNoClientCode.setAccessible(true); |
|
136 |
} |
|
137 |
catch (NoSuchFieldException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
138 |
log.fine("Unable to initialize ComponentAccessor", e); |
2 | 139 |
} |
140 |
catch (ClassNotFoundException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
141 |
log.fine("Unable to initialize ComponentAccessor", e); |
2 | 142 |
} |
143 |
catch (NoSuchMethodException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
144 |
log.fine("Unable to initialize ComponentAccessor", e); |
2 | 145 |
} |
146 |
// to please javac |
|
147 |
return null; |
|
148 |
} |
|
149 |
}); |
|
150 |
} |
|
151 |
||
152 |
public static void setX(Component c, int x) |
|
153 |
{ |
|
154 |
try { |
|
155 |
fieldX.setInt(c,x); |
|
156 |
} |
|
157 |
catch (IllegalAccessException e) |
|
158 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
159 |
log.fine("Unable to access the Component object", e); |
2 | 160 |
} |
161 |
} |
|
162 |
||
163 |
public static void setY(Component c, int y) |
|
164 |
{ |
|
165 |
try { |
|
166 |
fieldY.setInt(c,y); |
|
167 |
} |
|
168 |
catch (IllegalAccessException e) |
|
169 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
170 |
log.fine("Unable to access the Component object", e); |
2 | 171 |
} |
172 |
} |
|
173 |
||
174 |
public static void setWidth(Component c, int width) |
|
175 |
{ |
|
176 |
try { |
|
177 |
fieldWidth.setInt(c,width); |
|
178 |
} |
|
179 |
catch (IllegalAccessException e) |
|
180 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
181 |
log.fine("Unable to access the Component object", e); |
2 | 182 |
} |
183 |
} |
|
184 |
||
185 |
public static void setHeight(Component c, int height) |
|
186 |
{ |
|
187 |
try { |
|
188 |
fieldHeight.setInt(c,height); |
|
189 |
} |
|
190 |
catch (IllegalAccessException e) |
|
191 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
192 |
log.fine("Unable to access the Component object", e); |
2 | 193 |
} |
194 |
} |
|
195 |
||
196 |
public static void setBounds(Component c, int x, int y, int width, int height) |
|
197 |
{ |
|
198 |
try { |
|
199 |
fieldX.setInt(c,x); |
|
200 |
fieldY.setInt(c,y); |
|
201 |
fieldWidth.setInt(c,width); |
|
202 |
fieldHeight.setInt(c,height); |
|
203 |
} |
|
204 |
catch (IllegalAccessException e) |
|
205 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
206 |
log.fine("Unable to access the Component object", e); |
2 | 207 |
} |
208 |
} |
|
209 |
||
210 |
public static int getX(Component c) { |
|
211 |
try { |
|
212 |
return fieldX.getInt(c); |
|
213 |
} |
|
214 |
catch (IllegalAccessException e) |
|
215 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
216 |
log.fine("Unable to access the Component object", e); |
2 | 217 |
} |
218 |
return 0; |
|
219 |
} |
|
220 |
||
221 |
public static int getY(Component c) { |
|
222 |
try { |
|
223 |
return fieldY.getInt(c); |
|
224 |
} |
|
225 |
catch (IllegalAccessException e) |
|
226 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
227 |
log.fine("Unable to access the Component object", e); |
2 | 228 |
} |
229 |
return 0; |
|
230 |
} |
|
231 |
||
232 |
public static int getWidth(Component c) { |
|
233 |
try { |
|
234 |
return fieldWidth.getInt(c); |
|
235 |
} |
|
236 |
catch (IllegalAccessException e) |
|
237 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
238 |
log.fine("Unable to access the Component object", e); |
2 | 239 |
} |
240 |
return 0; |
|
241 |
} |
|
242 |
||
243 |
public static int getHeight(Component c) { |
|
244 |
try { |
|
245 |
return fieldHeight.getInt(c); |
|
246 |
} |
|
247 |
catch (IllegalAccessException e) |
|
248 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
249 |
log.fine("Unable to access the Component object", e); |
2 | 250 |
} |
251 |
return 0; |
|
252 |
} |
|
253 |
||
254 |
public static boolean getIsPacked(Component c) { |
|
255 |
try { |
|
256 |
return fieldPacked.getBoolean(c); |
|
257 |
} |
|
258 |
catch (IllegalAccessException e) |
|
259 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
260 |
log.fine("Unable to access the Component object", e); |
2 | 261 |
} |
262 |
return false; |
|
263 |
} |
|
264 |
||
265 |
public static Container getParent_NoClientCode(Component c) { |
|
266 |
Container parent=null; |
|
267 |
||
268 |
try { |
|
269 |
parent = (Container) methodGetParentNoClientCode.invoke(c, (Object[]) null); |
|
270 |
} |
|
271 |
catch (IllegalAccessException e) |
|
272 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
273 |
log.fine("Unable to access the Component object", e); |
2 | 274 |
} |
275 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
276 |
log.fine("Unable to invoke on the Component object", e); |
2 | 277 |
} |
278 |
||
279 |
return parent; |
|
280 |
} |
|
281 |
||
282 |
public static Font getFont_NoClientCode(Component c) { |
|
283 |
Font font=null; |
|
284 |
||
285 |
try { |
|
286 |
font = (Font) methodGetFontNoClientCode.invoke(c, (Object[]) null); |
|
287 |
} |
|
288 |
catch (IllegalAccessException e) |
|
289 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
290 |
log.fine("Unable to access the Component object", e); |
2 | 291 |
} |
292 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
293 |
log.fine("Unable to invoke on the Component object", e); |
2 | 294 |
} |
295 |
||
296 |
return font; |
|
297 |
} |
|
298 |
||
299 |
public static void processEvent(Component c, AWTEvent event) { |
|
300 |
Font font=null; |
|
301 |
||
302 |
try { |
|
303 |
Object[] args = new Object[1]; |
|
304 |
args[0] = event; |
|
305 |
methodProcessEvent.invoke(c,args); |
|
306 |
} |
|
307 |
catch (IllegalAccessException e) |
|
308 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
309 |
log.fine("Unable to access the Component object", e); |
2 | 310 |
} |
311 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
312 |
log.fine("Unable to invoke on the Component object", e); |
2 | 313 |
} |
314 |
} |
|
315 |
||
316 |
public static void enableEvents(Component c, long event_mask) { |
|
317 |
try { |
|
318 |
Object[] args = new Object[1]; |
|
319 |
args[0] = Long.valueOf(event_mask); |
|
320 |
methodEnableEvents.invoke(c,args); |
|
321 |
} |
|
322 |
catch (IllegalAccessException e) |
|
323 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
324 |
log.fine("Unable to access the Component object", e); |
2 | 325 |
} |
326 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
327 |
log.fine("Unable to invoke on the Component object", e); |
2 | 328 |
} |
329 |
} |
|
330 |
||
331 |
public static void setParent(Component c, Container parent) |
|
332 |
{ |
|
333 |
try { |
|
334 |
fieldParent.set(c,parent); |
|
335 |
} |
|
336 |
catch (IllegalAccessException e) |
|
337 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
338 |
log.fine("Unable to access the Component object", e); |
2 | 339 |
} |
340 |
} |
|
341 |
||
342 |
public static Color getForeground(Component c) |
|
343 |
{ |
|
344 |
Color color = null; |
|
345 |
try { |
|
346 |
color = (Color) fieldForeground.get(c); |
|
347 |
} |
|
348 |
catch (IllegalAccessException e) |
|
349 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
350 |
log.fine("Unable to access the Component object", e); |
2 | 351 |
} |
352 |
return color; |
|
353 |
} |
|
354 |
||
355 |
public static Color getBackground(Component c) |
|
356 |
{ |
|
357 |
Color color = null; |
|
358 |
try { |
|
359 |
color = (Color) fieldBackground.get(c); |
|
360 |
} |
|
361 |
catch (IllegalAccessException e) |
|
362 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
363 |
log.fine("Unable to access the Component object", e); |
2 | 364 |
} |
365 |
return color; |
|
366 |
} |
|
367 |
||
368 |
public static void setBackground(Component c, Color color) { |
|
369 |
try { |
|
370 |
fieldBackground.set(c, color); |
|
371 |
} |
|
372 |
catch (IllegalAccessException e) |
|
373 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
374 |
log.fine("Unable to access the Component object", e); |
2 | 375 |
} |
376 |
} |
|
377 |
||
378 |
public static Font getFont(Component c) |
|
379 |
{ |
|
380 |
Font f = null; |
|
381 |
try { |
|
382 |
f = (Font) fieldFont.get(c); |
|
383 |
} |
|
384 |
catch (IllegalAccessException e) |
|
385 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
386 |
log.fine("Unable to access the Component object", e); |
2 | 387 |
} |
388 |
return f; |
|
389 |
} |
|
390 |
||
391 |
public static ComponentPeer getPeer(Component c) { |
|
392 |
ComponentPeer peer = null; |
|
393 |
try { |
|
394 |
peer = (ComponentPeer)fieldPeer.get(c); |
|
395 |
} |
|
396 |
catch (IllegalAccessException e) |
|
397 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
398 |
log.fine("Unable to access the Component object", e); |
2 | 399 |
} |
400 |
return peer; |
|
401 |
} |
|
402 |
||
403 |
public static void setPeer(Component c, ComponentPeer peer) { |
|
404 |
try { |
|
405 |
fieldPeer.set(c, peer); |
|
406 |
} catch (IllegalAccessException e) |
|
407 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
408 |
log.fine("Unable to access the Component object", e); |
2 | 409 |
} |
410 |
} |
|
411 |
||
412 |
public static boolean getIgnoreRepaint(Component comp) { |
|
413 |
try { |
|
414 |
return fieldIgnoreRepaint.getBoolean(comp); |
|
415 |
} |
|
416 |
catch (IllegalAccessException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
417 |
log.fine("Unable to access the Component object", e); |
2 | 418 |
} |
419 |
||
420 |
return false; |
|
421 |
} |
|
422 |
||
423 |
public static boolean getVisible(Component c) { |
|
424 |
try { |
|
425 |
return fieldVisible.getBoolean(c); |
|
426 |
} |
|
427 |
catch (IllegalAccessException e) |
|
428 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
429 |
log.fine("Unable to access the Component object", e); |
2 | 430 |
} |
431 |
return false; |
|
432 |
} |
|
433 |
||
434 |
public static boolean isEnabledImpl(Component c) { |
|
435 |
boolean enabled = true; |
|
436 |
try { |
|
437 |
enabled = (Boolean) methodIsEnabledImpl.invoke(c, (Object[]) null); |
|
438 |
} |
|
439 |
catch (IllegalAccessException e) |
|
440 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
441 |
log.fine("Unable to access the Component object", e); |
2 | 442 |
} |
443 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
444 |
log.fine("Unable to invoke on the Component object", e); |
2 | 445 |
} |
446 |
return enabled; |
|
447 |
} |
|
448 |
||
449 |
public static Cursor getCursor_NoClientCode(Component c) { |
|
450 |
Cursor cursor = null; |
|
451 |
||
452 |
try { |
|
453 |
cursor = (Cursor) methodGetCursorNoClientCode.invoke(c, (Object[]) null); |
|
454 |
} |
|
455 |
catch (IllegalAccessException e) |
|
456 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
457 |
log.fine("Unable to access the Component object", e); |
2 | 458 |
} |
459 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
460 |
log.fine("Unable to invoke on the Component object", e); |
2 | 461 |
} |
462 |
||
463 |
return cursor; |
|
464 |
} |
|
465 |
||
466 |
public static Point getLocation_NoClientCode(Component c) { |
|
467 |
Point loc = null; |
|
468 |
||
469 |
try { |
|
470 |
loc = (Point) methodLocationNoClientCode.invoke(c, (Object[]) null); |
|
471 |
} |
|
472 |
catch (IllegalAccessException e) |
|
473 |
{ |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
474 |
log.fine("Unable to access the Component object", e); |
2 | 475 |
} |
476 |
catch (InvocationTargetException e) { |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
477 |
log.fine("Unable to invoke on the Component object", e); |
2 | 478 |
} |
479 |
||
480 |
return loc; |
|
481 |
} |
|
3938
ef327bd847c0
6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents:
2459
diff
changeset
|
482 |
|
2 | 483 |
} |