jdk/src/share/classes/sun/awt/SunToolkit.java
changeset 4371 dc9dcb8b0ae7
parent 4369 18b883ed2b58
child 5506 202f599c92aa
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Fri Dec 04 15:07:15 2009 +0300
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Mon Dec 07 13:43:04 2009 +0300
@@ -1119,6 +1119,18 @@
     }
 
     /**
+     * Gives native peers the ability to query the closest HW component.
+     * If the given component is heavyweight, then it returns this. Otherwise,
+     * it goes one level up in the hierarchy and tests next component.
+     */
+    public static Component getHeavyweightComponent(Component c) {
+        while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) {
+            c = AWTAccessor.getComponentAccessor().getParent(c);
+        }
+        return c;
+    }
+
+    /**
      * Returns a new input method window, with behavior as specified in
      * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
      * If the inputContext is not null, the window should return it from its