MCPcopy Index your code
hub / github.com/processing/processing / setCursor

Method setCursor

core/src/processing/opengl/PSurfaceJOGL.java:1234–1266  ·  view source on GitHub ↗
(int kind)

Source from the content-addressed store, hash-verified

1232
1233
1234 public void setCursor(int kind) {
1235 if (!cursorNames.containsKey(kind)) {
1236 PGraphics.showWarning("Unknown cursor type: " + kind);
1237 return;
1238 }
1239 CursorInfo cursor = cursors.get(kind);
1240 if (cursor == null) {
1241 String name = cursorNames.get(kind);
1242 if (name != null) {
1243 ImageIcon icon =
1244 new ImageIcon(getClass().getResource("cursors/" + name + ".png"));
1245 PImage img = new PImage(icon.getImage());
1246 // Most cursors just use the center as the hotspot...
1247 int x = img.width / 2;
1248 int y = img.height / 2;
1249 // ...others are more specific
1250 if (kind == PConstants.ARROW) {
1251 x = 10; y = 7;
1252 } else if (kind == PConstants.HAND) {
1253 x = 12; y = 8;
1254 } else if (kind == PConstants.TEXT) {
1255 x = 16; y = 22;
1256 }
1257 cursor = new CursorInfo(img, x, y);
1258 cursors.put(kind, cursor);
1259 }
1260 }
1261 if (cursor != null) {
1262 cursor.set();
1263 } else {
1264 PGraphics.showWarning("Cannot load cursor type: " + kind);
1265 }
1266 }
1267
1268
1269 public void setCursor(PImage image, int hotspotX, int hotspotY) {

Callers

nothing calls this directly

Calls 10

showWarningMethod · 0.95
setMethod · 0.95
containsKeyMethod · 0.80
getMethod · 0.65
getNativeMethod · 0.65
getImageMethod · 0.45
putMethod · 0.45
allocateMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected