jdk/src/share/classes/sun/awt/ComponentAccessor.java
changeset 2459 08f3416ff334
parent 2 90ce3da70b43
child 3938 ef327bd847c0
equal deleted inserted replaced
2458:f4bee3ba17ee 2459:08f3416ff334
    71     private static Field fieldForeground;
    71     private static Field fieldForeground;
    72     private static Field fieldFont;
    72     private static Field fieldFont;
    73     private static Field fieldPacked;
    73     private static Field fieldPacked;
    74     private static Field fieldIgnoreRepaint;
    74     private static Field fieldIgnoreRepaint;
    75     private static Field fieldPeer;
    75     private static Field fieldPeer;
    76     private static Method methodResetGC;
       
    77     private static Field fieldVisible;
    76     private static Field fieldVisible;
    78     private static Method methodIsEnabledImpl;
    77     private static Method methodIsEnabledImpl;
    79     private static Method methodGetCursorNoClientCode;
    78     private static Method methodGetCursorNoClientCode;
    80     private static Method methodLocationNoClientCode;
    79     private static Method methodLocationNoClientCode;
    81 
    80 
   122                         fieldIgnoreRepaint.setAccessible(true);
   121                         fieldIgnoreRepaint.setAccessible(true);
   123 
   122 
   124                         fieldPeer = componentClass.getDeclaredField("peer");
   123                         fieldPeer = componentClass.getDeclaredField("peer");
   125                         fieldPeer.setAccessible(true);
   124                         fieldPeer.setAccessible(true);
   126 
   125 
   127                         methodResetGC = componentClass.getDeclaredMethod("resetGC", (Class[]) null);
       
   128                         methodResetGC.setAccessible(true);
       
   129 
       
   130                         fieldVisible = componentClass.getDeclaredField("visible");
   126                         fieldVisible = componentClass.getDeclaredField("visible");
   131                         fieldVisible.setAccessible(true);
   127                         fieldVisible.setAccessible(true);
   132 
   128 
   133                         methodIsEnabledImpl = componentClass.getDeclaredMethod("isEnabledImpl", (Class[]) null);
   129                         methodIsEnabledImpl = componentClass.getDeclaredMethod("isEnabledImpl", (Class[]) null);
   134                         methodIsEnabledImpl.setAccessible(true);
   130                         methodIsEnabledImpl.setAccessible(true);
   423         }
   419         }
   424 
   420 
   425         return false;
   421         return false;
   426     }
   422     }
   427 
   423 
   428     public static void resetGC(Component c) {
       
   429         try {
       
   430             methodResetGC.invoke(c, (Object[]) null);
       
   431         }
       
   432         catch (IllegalAccessException e) {
       
   433             log.log(Level.FINE, "Unable to access the Component object", e);
       
   434         }
       
   435         catch (InvocationTargetException e) {
       
   436             log.log(Level.FINE, "Unable to invoke on the Component object", e);
       
   437         }
       
   438     }
       
   439 
       
   440     public static boolean getVisible(Component c) {
   424     public static boolean getVisible(Component c) {
   441         try {
   425         try {
   442             return fieldVisible.getBoolean(c);
   426             return fieldVisible.getBoolean(c);
   443         }
   427         }
   444         catch (IllegalAccessException e)
   428         catch (IllegalAccessException e)