previous
contents
next

Dragging

public void mouseDragged(MouseEvent event) {
    // Get mouse position
    int mouseX = event.getX();
    int mouseY = event.getY();
    if (draggingImage) {
       // Center image over mouse position
       imageX = mouseX - (imageWidth / 2);
       imageY = mouseY - (imageHeight / 2);
    }
}