import java.awt.event.*; import javax.swing.*; public class MouseMotion extends JFrame { public MouseMotion() { setSize( 600, 400 ); setDefaultCloseOperation( EXIT_ON_CLOSE ); getContentPane().addMouseMotionListener( new MouseMotionAdapter() { public void mouseDragged( MouseEvent e ) { System.err.println( "Arrastrado: " + e.getX() + ", " + e.getY() ); } } ); } public static void main( String [] args ) { MouseMotion motion = new MouseMotion(); motion.setVisible( true ); } }