Mouse motion input

Hello,
I want to invoke a method every time when the mouse cursor coordinates changes.
I have several objects which should be movable when the user clicked on a button. When something like a boolean isMoving is true, than I want to move the selected item.
So I want to get something like a MouseMotionListener in java Swing.
Every time the coords of the cursor changes, I text if the cursor is at the ground with ray picking.
When the user is moving an object, it should follow the mouse cursor till the user clicks. When the user clicks, the object is placed at the coordinate at the ground.
So can anyone tell me how I can update the object position on every mouse move?

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_input_system