How-To's > How do I enable users to drag and drop objects?
Use the onMouseDragged event to enable users to drag an object within a scene's boundaries.
For a simple code snippet and more details about the onMouseDragged event, see How do I create a response to a mouse event?
Example code for the objects to be dragged and the onMouseDragged event is provided in the following documents:
- Building GUI Applications With JavaFX: Lesson 8: Bringing Interactivity to GUI Elements
The section "Handling the Drag Event" provides information about dragging objects with the mouse.
API Documentation
- onMouseDragged variable of javafx.scene.Node
Last Updated: April 2010
[Return to How-To's Home]