Capture mouse in a bounding box?

Scott Palmer swpalmer at gmail.com
Fri Apr 12 09:22:42 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


On 2013-04-12, at 11:26 AM, Pavel Safrata <pavel.safrata at oracle.com> wrote:

> Hi Werner,
> no, there is no such feature. I would recommend to just not follow the mouse with the dragged object outside of the bounds. You can file a feature request to Jira if you want. Frankly, I don't think it will get a high priority unless you provide really compelling reason for it (I don't think it's an encouraged pattern, usually it's pretty frustrating for the user when the mouse doesn't move).
> Regards,
> Pavel
> 
> On 12.4.2013 17:11, Werner Lehmann wrote:
>> Hi,
>> 
>> is there a way to capture the mouse cursor to a bounding box? I am using simple-press-drag-and-release to move a node with the mouse, and I  want to keep the mouse inside the bounds of the node's parent control. Thx...
>> 
>> Rgds
>> Werner
> 



More information about the openjfx-dev mailing list