An Image in an Applet
Previous    Next    Home    Source    Package

Notes
  1. We can fix the deficiency of the previous example by adding variables xdiff and ydiff which hold the difference, in pixels, between the mouse pressed position and the origin of the image. Then xdiff and ydiff are added to the mouse position, wherever it drags the image - the result is a smooth and predictable dragging behavior.