Wheel mouse

From Processing

Jump to: navigation, search
Versions: 1.0+
Contributors: companje,fry
Started: 2008-01-11


With this snippet you can use the scroll wheel / mouse wheel in Processing. For more information, read the Java documentation about MouseWheelListener.

Source Code

/**
Wheel mouse taken from http://wiki.processing.org/index.php/Wheel_mouse
@author Rick Companje
*/
import java.awt.event.*;
 
void setup() {
  addMouseWheelListener(new MouseWheelListener() { 
    public void mouseWheelMoved(MouseWheelEvent mwe) { 
      mouseWheel(mwe.getWheelRotation());
  }}); 
}
 
void mouseWheel(int delta) {
  println("mouse has moved by " + delta + " units."); 
}
 
void draw() {
 
}

Downloads

Related Links

Personal tools