registered key event listener in class gets triggered multple times
in
Programming Questions
•
5 months ago
hey everyone. let's take a look at this short snippet:
- Foo foo;
- void setup(){
- foo= new Foo(this);
- }
- void draw(){
- }
- public class Foo{
- private PApplet parent;
- Foo(PApplet parent){
- this.parent= parent;
- this.parent.registerMethod("keyEvent", this);
- }
- public void keyEvent(KeyEvent e){
- println(e);
- }
- }
the problem i'm having is that the event listener keyEvent() appears to get triggered 3 times on every key press. am i missing something?
1