I recently needed to implement function keys in a Processing sketch, which are not defined as constants for keyCode() within Processing. I was able to sort it out using Java’s KeyEvent, which I was turned onto by this post on the Processing forum. Here is an example sketch I wrote for the function keys (can be easily adapted to other actions keys e.g. Page Up or Page Down):
// http://download.oracle.com/javase/1.4.2/docs/api/java/awt/event/KeyEvent.html import java.awt.event.KeyEvent; void setup() {} void draw() {} void keyPressed() { if (keyEvent.isActionKey() == true) { switch(keyCode) { case KeyEvent.VK_F1: println("F1"); break; case KeyEvent.VK_F2: println("F2"); break; case KeyEvent.VK_F3: println("F3"); break; default: println("other action key"); break; } } else { println("not an action key\n"); } }