jdk/test/java/awt/regtesthelpers/UtilInternal.java
changeset 30469 bac0a7ff7e1e
parent 28087 622b2f420bc3
child 36511 9d0388c6b336
equal deleted inserted replaced
30468:a016d2637922 30469:bac0a7ff7e1e
    29 import java.lang.reflect.InvocationTargetException;
    29 import java.lang.reflect.InvocationTargetException;
    30 import java.lang.reflect.Method;
    30 import java.lang.reflect.Method;
    31 import java.awt.Toolkit;
    31 import java.awt.Toolkit;
    32 import java.awt.Frame;
    32 import java.awt.Frame;
    33 
    33 
       
    34 import sun.awt.AWTAccessor;
    34 
    35 
    35 
    36 
    36 /**
    37 /**
    37    Class with static methods using internal/proprietary API by necessity.
    38    Class with static methods using internal/proprietary API by necessity.
    38 */
    39 */
    43     public static Frame createEmbeddedFrame(final Frame embedder)
    44     public static Frame createEmbeddedFrame(final Frame embedder)
    44         throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException,
    45         throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException,
    45                InstantiationException, InvocationTargetException
    46                InstantiationException, InvocationTargetException
    46     {
    47     {
    47         Toolkit tk = Toolkit.getDefaultToolkit();
    48         Toolkit tk = Toolkit.getDefaultToolkit();
    48         FramePeer frame_peer = (FramePeer) embedder.getPeer();
    49         FramePeer frame_peer = AWTAccessor.getComponentAccessor()
       
    50                                           .getPeer(embedder);
    49         System.out.println("frame's peer = " + frame_peer);
    51         System.out.println("frame's peer = " + frame_peer);
    50         if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) {
    52         if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) {
    51             Class comp_peer_class =
    53             Class comp_peer_class =
    52                 Class.forName("sun.awt.windows.WComponentPeer");
    54                 Class.forName("sun.awt.windows.WComponentPeer");
    53             System.out.println("comp peer class = " + comp_peer_class);
    55             System.out.println("comp peer class = " + comp_peer_class);