import greenfoot.*;  // (World, Actor, GreenfootImage, and Greenfoot)

public class Key extends Actor
{
    private String keyFromKeyboard;
    
    /**
     * Create a new key.
     */
    public Key(String key)
    {
        keyFromKeyboard = key;
    }

    /**
     * Do the action for this key.
     */
    public void act()
    {
        if(Greenfoot.isKeyDown(keyFromKeyboard)) {
            setImage(new GreenfootImage("white-key-down.png"));
        }
        else {
            setImage(new GreenfootImage("white-key.png"));
        }
    }
}