Easy way to make a class react to keyboard events