// like, on a keyboard class Key { PImage up, down; CapsFont f; Key(CapsFont font) { f = font; up = managedRequestImage("keyup.gif"); down = managedRequestImage("keydown.gif"); } int width() { return up.width; } int height() { return up.height; } void Draw(float xpos, float ypos, char c, boolean isUp, int s) { if (isUp) image(up, xpos, ypos, up.width*s, up.height*s); else image(down, xpos, ypos, up.width*s, up.height*s); int off = 2; if (!isUp) off = 3; f.Draw(xpos + off*s, ypos + off*s, c, s); } }