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

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

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

Native.getComponentID介绍

[英]Utility method to get the native window ID for a heavyweight Java Component as a long value. This method is primarily for X11-based systems, which use an opaque XID (usually long int) to identify windows.
[中]

代码示例

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

/** Utility method to get the native window ID for a Java {@link Window}
 * 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 getWindowID(Window w) throws HeadlessException {
  return getComponentID(w);
}

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

private static X11.Window getDrawable(Component w) {
  int id = (int)Native.getComponentID(w);
  if (id == X11.None)
    return null;
  return new X11.Window(id);
}

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

private static X11.Window getDrawable(Component w) {
  int id = (int)Native.getComponentID(w);
  if (id == X11.None)
    return null;
  return new X11.Window(id);
}

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

/** Utility method to get the native window pointer for a heavyweight Java 
 * {@link Component} as a {@link Pointer} value.  This method is primarily 
 * for w32, which uses the <code>HANDLE</code> type (actually 
 * <code>void *</code>) to identify windows. 
 * @throws HeadlessException if the current VM is running headless 
 */
public static Pointer getComponentPointer(Component c) throws HeadlessException {
  return new Pointer(getComponentID(c));
}

代码示例来源:origin: uk.co.caprica/vlcj

componentId = Native.getComponentID(component);
if (componentId != 0) {
  return componentId;

代码示例来源:origin: uk.co.caprica/vlcj

private long getComponentId(Component component) {
  if (!RuntimeUtil.isMac()) {
    return Native.getComponentID(component);
  } else {
    return OsxComponentId.getOsxComponentId(component);
  }
}

代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java

/**
 * Sets the native window for the {@link Element} to use to display video.
 *
 * @param window A native window to use to display video, or <tt>null</tt> to
 * stop using the previously set window.
 * @deprecated use {@link org.gstreamer.swing.XOverlaySwing#setWindowHandle(java.awt.Component)} instead
 */
@Deprecated
public void setWindowHandle(java.awt.Component window) {
  if (window == null) {
    setWindowHandle(0);
    return;
  }
  if (window.isLightweight())
    throw new IllegalArgumentException("Component must be a native window");
  if (Platform.isWindows())
    GSTXOVERLAY_API.gst_x_overlay_set_window_handle(this, Native.getComponentPointer(window));
  else
    setWindowHandle(Native.getComponentID(window));
}

代码示例来源:origin: com.googlecode.gstreamer-java/gstreamer-java

/**
   * Sets the native window for the {@link Element} to use to display video.
   *
   * @param window A native window to use to display video, or <tt>null</tt> to
   * stop using the previously set window.
   */
  public void setWindowHandle(java.awt.Component window) {
    
    long nativeWindow = 0;

    if (window != null) {
    
      if (window.isLightweight()) {
        throw new IllegalArgumentException("Component must be a native window");
      }
    
      if (Platform.isWindows()) {
        nativeWindow = Pointer.nativeValue(Native.getComponentPointer(window));
      } else {
        nativeWindow = Native.getComponentID(window);
      }
    }
         setWindowHandle(nativeWindow);
  }
}

代码示例来源:origin: gstreamer-java/gst1-java-core

/**
 * Sets the native window for the {@link Element} to use to display video.
 *
 * @param window A native window to use to display video, or <tt>null</tt> to
 * stop using the previously set window.
 */
public void setWindowHandle(java.awt.Component window) {
  if (window == null) {
    setWindowHandle(0);
    return;
  }
  if (window.isLightweight())
    throw new IllegalArgumentException("Component must be a native window");
  if (Platform.isWindows())
    GSTVIDEOOVERLAY_API.gst_video_overlay_set_window_handle(this, Native.getComponentPointer(window));
  else
    setWindowHandle(Native.getComponentID(window));
}

代码示例来源:origin: gstreamer-java/gst1-java-core

/**
 * Sets the native window for the {@link Element} to use to display video.
 *
 * @param window A native window to use to display video, or <tt>null</tt> to
 * stop using the previously set window.
 */
public void setWindowHandle(java.awt.Component window) {
  if (window == null) {
    setWindowHandle(0);
    return;
  }
  if (window.isLightweight())
    throw new IllegalArgumentException("Component must be a native window");
  if (Platform.isWindows())
    GSTXOVERLAY_API.gst_x_overlay_set_window_handle(this, Native.getComponentPointer(window));
  else
    setWindowHandle(Native.getComponentID(window));
}

代码示例来源:origin: uk.co.caprica/vlcj

int videoSurfaceComponentId = (int)Native.getComponentID(canvas);

代码示例来源:origin: uk.co.caprica/vlcj

/**
 * Set the full-screen state of the window.
 *
 * @param fullScreen <code>true</code> to set full-screen; <code>false</code> to exit full-screen
 */
void setFullScreen(boolean fullScreen) {
  HWND hWnd = getHWND(Native.getComponentID(window));
  if (fullScreen) {
    windowState = getWindowState(hWnd);
    ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_STYLE, windowState.getStyle() & ~(WS_CAPTION | WS_THICKFRAME));
    ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_EXSTYLE, windowState.getExStyle() & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
    MONITORINFO monitorInfo = getMonitorInfo(hWnd);
    RECT rect = monitorInfo.rcMonitor;
    ExtendedUser32.INSTANCE.SetWindowPos(hWnd, null, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
  }
  else {
    ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_STYLE, windowState.getStyle());
    ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_EXSTYLE, windowState.getExStyle());
    ExtendedUser32.INSTANCE.SetWindowPos(hWnd, null, windowState.getLeft(), windowState.getTop(), windowState.getRight() - windowState.getLeft(), windowState.getBottom() - windowState.getTop(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
    if (windowState.getMaximized()) {
      ExtendedUser32.INSTANCE.SendMessage(hWnd, User32.WM_SYSCOMMAND, new WPARAM(WinUser.SC_MAXIMIZE), new LPARAM(0));
    }
  }
}

相关文章

Native类方法