com.sun.jna.Native.getWindowHandle0()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中com.sun.jna.Native.getWindowHandle0()方法的一些代码示例,展示了Native.getWindowHandle0()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Native.getWindowHandle0()方法的具体详情如下:
包路径:com.sun.jna.Native
类名称:Native
方法名:getWindowHandle0

Native.getWindowHandle0介绍

暂无

代码示例

代码示例来源:origin: net.java.dev.jna/jna

static long getComponentID(Object o) throws HeadlessException {
    if (GraphicsEnvironment.isHeadless()) {
      throw new HeadlessException("No native windows when headless");
    }
    Component c = (Component)o;
    if (c.isLightweight()) {
      throw new IllegalArgumentException("Component must be heavyweight");
    }
    if (!c.isDisplayable())
      throw new IllegalStateException("Component must be displayable");
    // On X11 VMs prior to 1.5, the window must be visible
    if (Platform.isX11()
      && System.getProperty("java.version").startsWith("1.4")) {
      if (!c.isVisible()) {
        throw new IllegalStateException("Component must be visible");
      }
    }
    // By this point, we're certain that Toolkit.loadLibraries() has
    // been called, thus avoiding AWT/JAWT link errors
    // (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705).
    return Native.getWindowHandle0(c);
  }
}

代码示例来源:origin: org.elasticsearch/jna

static long getComponentID(Object o) throws HeadlessException {
    if (GraphicsEnvironment.isHeadless()) {
      throw new HeadlessException("No native windows when headless");
    }
    Component c = (Component)o;
    if (c.isLightweight()) {
      throw new IllegalArgumentException("Component must be heavyweight");
    }
    if (!c.isDisplayable())
      throw new IllegalStateException("Component must be displayable");
    // On X11 VMs prior to 1.5, the window must be visible
    if (Platform.isX11()
      && System.getProperty("java.version").startsWith("1.4")) {
      if (!c.isVisible()) {
        throw new IllegalStateException("Component must be visible");
      }
    }
    // By this point, we're certain that Toolkit.loadLibraries() has
    // been called, thus avoiding AWT/JAWT link errors
    // (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705).
    return Native.getWindowHandle0(c);
  }
}

代码示例来源:origin: com.sun.jna/jna

/** Utility method to get the native window ID for a heavyweight Java 
 * {@link Component} as a <code>long</code> value.
 * This method is primarily for X11-based systems, which use an opaque
 * <code>XID</code> (usually <code>long int</code>) to identify windows. 
 * @throws HeadlessException if the current VM is running headless 
 */
public static long getComponentID(Component c) throws HeadlessException {
  if (GraphicsEnvironment.isHeadless()) {
    throw new HeadlessException("No native windows when headless");
  }
  if (c.isLightweight()) {
    throw new IllegalArgumentException("Component must be heavyweight");
  }
  if (!c.isDisplayable()) 
    throw new IllegalStateException("Component must be displayable");
  // On X11 VMs prior to 1.5, the window must be visible
  if (Platform.isX11()
    && System.getProperty("java.version").matches("^1\\.4\\..*")) {
    if (!c.isVisible()) {
      throw new IllegalStateException("Component must be visible");
    }
  }
  // By this point, we're certain that Toolkit.loadLibraries() has
  // been called, thus avoiding AWT/JAWT link errors
  // (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705).
  return getWindowHandle0(c);
}

相关文章

Native类方法