Java Rogue-like RPGs

I just started learning java about a month ago, and I’m trying to write a rogue-like rpg using an applet. I need to use keylisteners, but I have no idea how. Supposedly I need to set the focus to a component, but my program doesn’t have any. It’s just a black rectangle (for the background) and text displayed using the drawstring method. So the keylistener always returns null, and obviously I don’t want that. Can someone help me with this?

Just add the keylistener to your frame and you’ll be fine.

He’s using an applet. Its always good to start with the basics