void keyPressed() { switch(keyCode) { case RIGHT: activeImg++; break; case LEFT: activeImg--; break; } if(activeTool < 0) { activeTool = toolNames.length - 1; } else if (activeTool > toolNames.length - 1) { activeTool = 0; } if(activeImg < 0) { activeImg = img.length - 1; } else if (activeImg > img.length - 1) { activeImg = 0; } if(key == 'n') { loadBackgroundImages(); } }