• 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

Contact programming-other
Read More 100 Hits
Rasco Resizer - documentation programming-other
Read More 93 Hits
Programming partners programming-other
Read More 205 Hits
Read More 436 Hits

Most read content

New articles

Contact programming-other
Read More 100 Hits
Rasco Resizer - documentation programming-other
Read More 93 Hits
Programming partners programming-other
Read More 205 Hits
Read More 436 Hits
Design by i-cons.ch / etosha-namibia.ch