• 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 1962 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2780 Hits
Inverse kinematics Machine Learning and Robotics
Read More 3651 Hits
gpsim tutorial Machine Learning and Robotics
Read More 8875 Hits

Most read content

A* search algorithm Machine Learning and Robotics
Read More 11225 Hits
gpsim tutorial Machine Learning and Robotics
Read More 8875 Hits

New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1962 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2780 Hits
Inverse kinematics Machine Learning and Robotics
Read More 3651 Hits
gpsim tutorial Machine Learning and Robotics
Read More 8875 Hits
Design by i-cons.ch / etosha-namibia.ch