在Mac上使用JNA从JComponent获取NSWindow [英] Using JNA to Get NSWindow from JComponent on mac

查看:163
本文介绍了在Mac上使用JNA从JComponent获取NSWindow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用JNA获取Mac上JComponent的基础NSWindow的指针或窗口号.我在com.sun.jna.Native中找到了方法getWindowID和getWindowPointer. 文档提到getWindowID用于X11,而getWindowPointer用于win32. Mac OSX有类似的功能吗?我知道如何使用JNI函数获取组件的可可窗口,但是我对不使用JNI函数而在Java中使用某些东西感兴趣.

Is it possible to get the pointer or the window number of the underlying NSWindow of a JComponent on Mac, using JNA. I found methods getWindowID and getWindowPointer in com.sun.jna.Native. The documentation mentions getWindowID is for X11 and getWindowPointer is for win32. Is there a similar function for Mac OSX ?? I know how to get the cocoa window of a component using a JNI function but I am interested in using something in Java without writing a JNI function.

-谢谢, Abhinay.

-Thanks, Abhinay.

推荐答案

getWindowPointer()对于Mac OSX执行相同的操作(它返回对应于可可视图引用的指针).您可能需要进行其他操作才能获得对所需参考的精确参考.根据 Denis 的建议, rococoa 可能有一些实用程序可以提供有用的功能.

getWindowPointer() does the same thing for Mac OSX (it returns a pointer corresponding to the cocoa view ref). You may have to do additional manipulations to get a reference to the exact reference you need; as Denis suggests, rococoa likely has some utilities that would provide useful.

这篇关于在Mac上使用JNA从JComponent获取NSWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆