Reputation: 81
The event within
main.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, new EventHandler<MouseEvent>() {}
is not called when the mouse button is held down, is there anyway around this? Thanks.
Upvotes: 3
Views: 212
Reputation: 209339
A mouse moved with the mouse button down is a MOUSE_DRAGGED
event. So you can do:
EventHandler<MouseEvent> handler = event -> { /* ... */};
main.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, handler);
main.getScene().addEventFilter(MouseEvent.MOUSE_DRAGGED, handler);
Upvotes: 4
Reputation: 481
You have to use this move event when the mouse is pressed :
MOUSE_DRAGGED
Upvotes: 1