我尝试使用可与java.awt.panel一起使用的JNA Native.getComponentPointer()方法,但是我不知道使用javafx.scene.layout.Pane做到这一点的好方法
有人知道有什么方法可以获取窗格的hWnd吗?
解决方法:
不幸的是,我认为JavaFX无法做到这一点.我可以看到的唯一具有本地对等对象的是舞台.您可以使用Windows SDK中的ui分析器工具(例如WinSpy或“ inspect.exe”或“ visualuiaverifynative.exe”)自己进行验证.
从Mixing Heavyweight and Lightweight Components by Oracle开始:
There are two kinds of graphics components in the Java programming language: heavyweight and lightweight. A heavyweight component is associated with its own native screen resource (commonly known as a peer). Components from the java.awt package, such as Button and Label, are heavyweight components.
[…]
A lightweight component has no native screen resource of its own, so it is “lighter.” A lightweight component relies on the screen resource from an ancestor in the containment hierarchy, possibly the underlying Frame object. Components from the javax.swing package, such as JButton and JLabel, are lightweight components.
在这种情况下,JavaFX就像Swing.一个轻量级的工具箱,其中的各种ui组件都用Java编写,没有本地对等项.