// Create the interactor to do the work.
Interactor dragger = new DragInteractor();
dragger.setMouseFilter(MouseFilter.defaultFilter);
// Create a rectangle and make it draggable
BasicFigure blue = new BasicRectangle(10.0, 10.0, 50.0, 50.0,
Color.blue);
layer.add(blue);
blue.setInteractor(dragger);
// Create a circle and make it draggable
BasicFigure red = new BasicEllipse(200.0, 200.0, 50.0, 50.0, Color.red);
layer.add(red);
red.setInteractor(dragger);