Capture mouse in a bounding box?

Herve Girod herve.girod at
Sat Apr 13 08:24:56 PDT 2013

*> I have a few use cases for this sort of thing, I use the Robot
class to reposition the mouse cursor to solve it.  Is there an
official Robot for JavaFX in 8.0?

> Some other cases:

> - A control that you grab and while the button is pressed the mouse is spinning a wheel or something like that.  You don't want the cursor to hit the edge of the screen and stop sending events.

> - Aiming in a first-person shooter.. same thing, you want to keep getting events, so you must prevent the mouse cursor from hitting a screen edge.

> Scott*

We use Java apps for avionics displays simulation. In this context, xe
use Robot with Swing because we use a joystick or a trackball rather
than a mouse, and we put restrictions on the parts of the displays
that can be accessed. Also we also are sometimes implement a caging
effect on text fields where we don't allow the selector to exit the
widget focus zone "easily".


More information about the openjfx-dev mailing list