JTF > Demo Gallery > acm.graphics > DragObjects

The programs in this package all have the same effect but use four different strategies for intercepting mouse events:

  1. Listeners at the GraphicsProgram level
  2. Listeners defined as anonymous inner classes
  3. Listeners detecting events in the GObjects
  4. Callback methods in the style of objectdraw

The package also includes the code example from the JTF Rationale that implements object-dragging in a standalone JFrame and an implementation that makes it possible to move the objects using the arrow keys as well.