jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java
changeset 44545 83b611b88ac8
parent 36511 9d0388c6b336
child 44752 97a2817b5a9b
equal deleted inserted replaced
44480:2c33418a6d57 44545:83b611b88ac8
    79         } else if (System.getProperty("os.name").startsWith("Mac")) {
    79         } else if (System.getProperty("os.name").startsWith("Mac")) {
    80             Point2D point2d;
    80             Point2D point2d;
    81             try {
    81             try {
    82                 // sun.lwawt.macosx.CTrayIcon
    82                 // sun.lwawt.macosx.CTrayIcon
    83                 Field f_peer = getField( java.awt.TrayIcon.class, "peer");
    83                 Field f_peer = getField( java.awt.TrayIcon.class, "peer");
    84                 Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class);
    84                 Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class);
    85                 m_addExports.invoke(null, "sun.lwawt.macosx", robot.getClass().getModule());
    85                 m_addExports.invoke(null, "sun.lwawt.macosx", robot.getClass().getModule());
    86 
    86 
    87 
    87 
    88                 Object peer = f_peer.get(icon);
    88                 Object peer = f_peer.get(icon);
    89                 Method m_getModel = peer.getClass().getDeclaredMethod(
    89                 Method m_getModel = peer.getClass().getDeclaredMethod(
   103                 return null;
   103                 return null;
   104             }
   104             }
   105         } else {
   105         } else {
   106             try {
   106             try {
   107                 // sun.awt.X11.XTrayIconPeer
   107                 // sun.awt.X11.XTrayIconPeer
   108                 Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class);
   108                 Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class);
   109                 m_addExports.invoke(null, "sun.awt.X11", robot.getClass().getModule());
   109                 m_addExports.invoke(null, "sun.awt.X11", robot.getClass().getModule());
   110 
   110 
   111                 Field f_peer = getField(java.awt.TrayIcon.class, "peer");
   111                 Field f_peer = getField(java.awt.TrayIcon.class, "peer");
   112 
   112 
   113                 SystemTrayIconHelper.openTrayIfNeeded(robot);
   113                 SystemTrayIconHelper.openTrayIfNeeded(robot);