• Increase font size
  • Default font size
  • Decrease font size

KeyEvent variable in the Processing

Have you ever wanted to get a Java Key Code (KeyEvent) of the key that was pressed or released?

 

To get your code, you have actually two options:

Option 1:

void keyPressed() {
println( "pressed -> keyCode: " + keyEvent.getKeyCode() );
}
 
void keyReleased(){
println( "released -> keyCode: " + keyEvent.getKeyCode() );
}

 

Option 2:

void keyPressed(KeyEvent e){
println("pressed -> " + e.getKeyCode());
}
 
void keyReleased(KeyEvent e){
println( "released -> keyCode: " + e.getKeyCode() );
}

 

 

Add comment

No bad words.


Security code
Refresh


New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1631 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2412 Hits
Inverse kinematics Machine Learning and Robotics
Read More 2928 Hits
gpsim tutorial Machine Learning and Robotics
Read More 5255 Hits

New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1631 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2412 Hits
Inverse kinematics Machine Learning and Robotics
Read More 2928 Hits
gpsim tutorial Machine Learning and Robotics
Read More 5255 Hits
Design by i-cons.ch / etosha-namibia.ch