JavaFX-使节点对事件不可见 [英] JavaFX - Make Node invisible for events
本文介绍了JavaFX-使节点对事件不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要为鼠标事件使JavaFX中的某些节点不可见.例如,有一个HBox,其中包含6个元素,并且在HBox上有一个矩形,现在我需要在HBox的6个元素上捕获MouseEntered和MouseExited事件,这是不可能的,因为Rectangle正在捕获它们.
I need to make some Nodes in JavaFX invisible for Mouse Events. For example, there is a HBox with 6 Elements within and one Rectangle over the HBox, now I need to catch the MouseEntered and MouseExited Events on the 6 Elements of the HBox, which is not possible because the Rectangle is catching them.
谢谢您的回答
推荐答案
使用 node.setMouseTransparent(true);
使节点对鼠标事件透明.
Use node.setMouseTransparent(true);
to make the node transparent to mouse event.
这篇关于JavaFX-使节点对事件不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文