Back to all rules
What this rule checks
Defines an event handler
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
color c = color(255);

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

void draw() {
  fill(c);
  ellipse(200, 200, 80, 80);
}

void mousePressed() {
  c = color(random(255), random(255), random(255));
}
FAIL — this code triggers the rule
color c = color(255);

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

void draw() {
  if (mousePressed) {  // polls the mouse instead of a mousePressed() handler
    c = color(random(255), random(255), random(255));
  }
  fill(c);
  ellipse(200, 200, 80, 80);
}
Overview
Category Topic Event Handling
Level Basic
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasEventHandlerRule
Message template No event handler functions found.