Java by API/org.eclipse.swt.events/MouseMoveListener
implements MouseMoveListener
import java.util.Random;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MainClass {
public static void main(String[] a) {
Display d = new Display();
final Shell s = new Shell(d);
s.setSize(250, 200);
s.setText("A MouseListener Example");
final Button b = new Button(s, SWT.PUSH);
b.setText("Push Me");
b.setBounds(20, 50, 55, 25);
s.open();
b.addMouseMoveListener(new MouseMoveListener() {
public void mouseMove(MouseEvent e) {
System.out.println(e.x);
}
});
while (!s.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
}
}