(Object o)
| 2540 | // Declaring the argument as Object rather than Component avoids class not |
| 2541 | // found errors on phoneME foundation profile. |
| 2542 | static long getComponentID(Object o) throws HeadlessException { |
| 2543 | if (GraphicsEnvironment.isHeadless()) { |
| 2544 | throw new HeadlessException("No native windows when headless"); |
| 2545 | } |
| 2546 | Component c = (Component)o; |
| 2547 | if (c.isLightweight()) { |
| 2548 | throw new IllegalArgumentException("Component must be heavyweight"); |
| 2549 | } |
| 2550 | if (!c.isDisplayable()) |
| 2551 | throw new IllegalStateException("Component must be displayable"); |
| 2552 | // On X11 VMs prior to 1.5, the window must be visible |
| 2553 | if (Platform.isX11() |
| 2554 | && System.getProperty("java.version").startsWith("1.4")) { |
| 2555 | if (!c.isVisible()) { |
| 2556 | throw new IllegalStateException("Component must be visible"); |
| 2557 | } |
| 2558 | } |
| 2559 | // By this point, we're certain that Toolkit.loadLibraries() has |
| 2560 | // been called, thus avoiding AWT/JAWT link errors |
| 2561 | // (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705). |
| 2562 | return Native.getWindowHandle0(c); |
| 2563 | } |
| 2564 | } |
| 2565 | } |
no test coverage detected