Implement a MouseMotionListener, and you can do something like this:
public void mouseDragged(MouseEvent e)
{
//setLocation( ....);
//Make use of e.getX(), e.getY() methods to set the new location
}