• 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 1917 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2728 Hits
Inverse kinematics Machine Learning and Robotics
Read More 3466 Hits
gpsim tutorial Machine Learning and Robotics
Read More 8554 Hits

Most read content

New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1917 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2728 Hits
Inverse kinematics Machine Learning and Robotics
Read More 3466 Hits
gpsim tutorial Machine Learning and Robotics
Read More 8554 Hits
Design by i-cons.ch / etosha-namibia.ch