monitor mouse events but not capture them
tbee at tbee.org
Mon Jun 9 06:19:27 UTC 2014
Maybe someone has solved this already, so I thought I pop the question. Currently I'm working on CirclePopupMenu; a menu that is supposed to pop up on any place in a scene when a certain (usually the middle or right) mouse button is pressed.
Right now CirclePopupMenu requires a stackpane to which it binds itself. CirclePopupMenu initially places an empty "canvas" Pane on the stack pane, and will use that to render and position the menu when it needs to appear.
Also I need to monitor the mouse to detect if the menu should appear. In order to do that, I would like to use that canvas pane, but then any non relevant button clicks will not reach the underlying controls. In order to enable correct behavior I need to setPickOnBounds(false) on the pane, but then it does receive the mouse events anymore.
Is there any way to monitor mouse events but still pass them through to the underlying controls? In Swing I did something similar and used a system level mouse event hook.
PS: I'm not certain if the stackpane approach I've used is the best way to do this. It does work expect the mouse button problem. But any suggestions are welcome.
More information about the openjfx-dev