can a java applet use keyboard shortcut keys?

Is it possible to have keyboard commands activate items in a java applet? For example if a java applet has 5 buttons that each do something, could you have those buttons activated with the keyboard number keys or with key combinations such as ctrl-1, cntrl-2, etc…

Sorry for such a simplistic question.

[url=http://leepoint.net/notes-java/30GUI/50keyboard/keyboard.html]Here’s a starter ref. page for doing this. Check into the associated methods given.

BTW: This was the first hit from Google for
java “control keys”

Fixed link.

To set up control key shortcuts in a Swing app, look at the setAccelerator method on the JMenuItem. If you want to use number keys instead of control-key combinations, you’d need to use a key listener. If you’re not using Swing, there are similar ways using AWT or whatever you’re using to build your GUI.