[英]Using JNA to Get NSWindow from JComponent on mac
Is it possible to get the pointer or the window number of the underlying NSWindow of a JComponent on Mac, using JNA. 是否可以使用JNA在Mac上获取JComponent的基础NSWindow的指针或窗口号。 I found methods getWindowID and getWindowPointer in com.sun.jna.Native.
我在com.sun.jna.Native中找到了方法getWindowID和getWindowPointer。 The documentation mentions getWindowID is for X11 and getWindowPointer is for win32.
该文档提到getWindowID用于X11,而getWindowPointer用于win32。 Is there a similar function for Mac OSX ??
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.
我知道如何使用JNI函数获取组件的可可窗口,但我有兴趣在Java中使用某些东西而无需编写JNI函数。
-Thanks, Abhinay. 谢谢阿比奈。
getWindowPointer()
does the same thing for Mac OSX (it returns a pointer corresponding to the cocoa view ref). 对于Mac OSX,
getWindowPointer()
做同样的事情(它返回与可可视图引用相对应的指针)。 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.
正如丹尼斯(Denis)所建议的那样, 洛可可可能具有一些实用工具,可以提供有用的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.