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