java.awt.Window.getPeer()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(255)

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

Window.getPeer介绍

暂无

代码示例

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

public void run() {
    Object peer = w.getPeer();
    try {
      peer.getClass().getMethod("setAlpha", new Class[]{
          float.class
        }).invoke(peer, new Object[]{
            new Float(alpha)
          });
    }
    catch (Exception e) {
    }
  }
});

代码示例来源:origin: com.metsci.glimpse/glimpse-platform-fixes

private static Long getHwnd( Window window )
{
  try
  {
    @SuppressWarnings( "deprecation" )
    ComponentPeer peer = window.getPeer( );
    Class<?> wcpClass = Class.forName( "sun.awt.windows.WComponentPeer" );
    if ( wcpClass.isInstance( peer ) )
    {
      return ( Long ) wcpClass.getMethod( "getHWnd" ).invoke( peer );
    }
    else
    {
      return null;
    }
  }
  catch ( Exception e )
  {
    return null;
  }
}

代码示例来源:origin: JetBrains/jediterm

@SuppressWarnings("deprecation")
public static ID findWindowFromJavaWindow(final Window w) {
 ID windowId = null;
 if (SystemInfo.isJavaVersionAtLeast("1.7") && Registry.is("skip.untitled.windows.for.mac.messages")) {
  try {
   //noinspection deprecation
   Class <?> cWindowPeerClass  = w.getPeer().getClass();
   Method getPlatformWindowMethod = cWindowPeerClass.getDeclaredMethod("getPlatformWindow");
   Object cPlatformWindow = getPlatformWindowMethod.invoke(w.getPeer());
   Class <?> cPlatformWindowClass = cPlatformWindow.getClass();
   Method getNSWindowPtrMethod = cPlatformWindowClass.getDeclaredMethod("getNSWindowPtr");
   windowId = new ID((Long)getNSWindowPtrMethod.invoke(cPlatformWindow));
  }
  catch (NoSuchMethodException e) {
   LOG.debug(e);
  }
  catch (InvocationTargetException e) {
   LOG.debug(e);
  }
  catch (IllegalAccessException e) {
   LOG.debug(e);
  }
 }
 else {
  String foremostWindowTitle = getWindowTitle(w);
  windowId = findWindowForTitle(foremostWindowTitle);
 }
 return windowId;
}

相关文章

Window类方法