Thursday, 12 September 2013

JavaFX: Best practice to implement glasspane-like mouse/touch event receiver which forwards events to underlying controls

JavaFX: Best practice to implement glasspane-like mouse/touch event
receiver which forwards events to underlying controls

My challenge is following situation:
I want to add an invisible (opacity 0) pane over the whole application,
which receives all mouse and touch events. When an event occurs it resets
some kind of activity timer.
My first approach (without such pane) was adding listeners to the root
pane, which worked pretty well. But... the buttons consume all events, so
the timer does not get reset.
In my opinion, the glasspane solution would be a much more nicer solution,
but I can't find a solution to forward received mouse and touch events to
the underlying controls.
In short: the pane intercepts a mouse event (trigger to reset timer), and
the underlying button gets clicked.
Any ideas please?

No comments:

Post a Comment