How can I disable a node without graying it out in JavaFX?

My problem is that I can disable nodes so that users cannot interact with them when printing However, for the same reason, I need that the entire node (in this case, a gridpane) and all its child nodes (mainly buttons and labels) cannot be interacted by the user while printing is in progress

When I write setdisable, it will gray the entire node, but I want to keep the original color and state of the node when disabled

Is there any way to do this? Whether through disableproperty or other methods, it is not particularly important to me The key here is that you should not interact with node

Thank you in advance

Solution

I found the answer:

All nodes from @awksp "JavaFX" have a setmousetransparent () method. See here for details. The mousetransparent attribute is:

If true, this node (and all its child nodes) is completely transparent to mouse events When selecting the target of a mouse event, nodes and their subtrees with mousetransparent set to true will not be considered “

Then I further used setfocustraversable (false), so you can't interact with the node by focusing in other ways

Thanks @awksp for your help: https://stackoverflow.com/a/24164911/6197978

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>