Filtering out AXIS_WHEEL events handled by a Nifty HUD

I’m developing in JME SDK 3.0RC2, using Nifty to provide a heads-up display (HUD) for my game.
The HUD includes a scrollPanel, and Nifty (very reasonably, I think) uses scroll wheel events to scroll
the scrollPanel whenever the mouse pointer is over the HUD.

I’ve written a custom camera control which uses scroll wheel events to dolly the camera in and out.
My control’s onAnalog() listener method gets scroll wheel events whenever the wheel turns,
regardless of the mouse location or whether Nifty used the event. I want to separate the two
functions, so I need my listener to ignore events which will be (or have been) used by Nifty.
How can I do this?

I can get the mouse position from the input manager, so perhaps I just need a clean way to
determine whether that position is in the HUD or not. (I could hardcode a test like x < 100, but that
would break if I ever changed the layout of the HUD, so it’s not what I’d call clean.) Is there a
method to test whether a viewport location is inside a particular Nifty element? Or failing that,
a method to measure the transparency of a pixel in the GUI viewport?

I’d appreciate any helpful pointers.

I’m marking this as resolved because I found a solution using de.lessvoid.nifty.elements.Element.isMouseInsideElement() . It required me to give the HUD’s enclosing panel an “id=” attribute so I could access it easily from Java. (My Nifty layout is in XML.) The trickiest bit was converting the input manager mouse coordinates to Nifty mouse coordinates (reversing the Y-coordinate and rounding floats to ints).

If anyone can think of a better solution, I’d be interested.