I would have answered in a comment but there's too much detail for that. The following code is taken pretty much exactly from an applet in which I had to limit FPS the same way you are now (except it was on mouseMove instead of keyPressed).
private long lastDrawTime = 0;
public void keyPressed(KeyEvent e) {
if (Calendar.getInstance().getTimeInMillis() - lastDrawTime < 20) return;
//do whatever needs to be done before redrawing
draw();
lastDrawTime = Calendar.getInstance().getTimeInMillis();
}
What's happening here is that there is an instance variable lastDrawTime
that stores the time that the last redraw happened. This variable is compared to the current time of the keyPressed event being fired before any drawing happens. If the difference in time is less than the allowed interval, in this case 20 milliseconds, or 50 frames per second, then the function returns and no drawing or updating is done. If enough time has passed, however, all the normal stuff is done, and the current time is stored in the variable.