This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

cursor()

Examples
// Move the mouse left and right across the image
// to see the cursor change from a cross to a hand

void setup() {
  size(100, 100);
}

void draw() {
  if (mouseX < 50) {
    cursor(CROSS);
  } else {
    cursor(HAND);
  }
}
Description Sets the cursor to a predefined symbol or an image, or makes it visible if already hidden. If you are trying to set an image as the cursor, the recommended size is 16x16 or 32x32 pixels. The values for parameters x and y must be less than the dimensions of the image.

Setting or hiding the cursor does not generally work with "Present" mode (when running full-screen).

With the P2D and P3D renderers, a generic set of cursors are used because the OpenGL renderer doesn't have access to the default cursor images for each platform (Issue 3791).
Syntax
cursor(kind)
cursor(img)
cursor(img, x, y)
cursor()
Parameters
kind int: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT
img PImage: any variable of type PImage
x int: the horizontal active spot of the cursor
y int: the vertical active spot of the cursor
Returnsvoid
RelatednoCursor()
Updated on January 21, 2019 10:05:09am EST

Creative Commons License