Hi there:
I believe I've discovered a bug with the JComponent class. I
created a bean that extends JComponent making use of the method
registerKeyboardAction(ActionListener anAction, String aCommand,
KeyStroke aKeyStroke, int aCondition). When I made use of my bean in an
application the keystokes that I registered using this method certainly
worked fine, but then today I decided to use my bean in an applet.
Suddenly the keystokes that I registered aren't working. I can't figure
out why that is...or how to work around this problem?

Here's the function in my bean that gets called when the bean first
becomes initialized:

private void registerKeyStrokes()
{
if(activeCellEnabled)
{
registerKeyboardAction(new NewAction("MoveLeft"),
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), WHEN_FOCUSED);
registerKeyboardAction(new NewAction("MoveRight"),
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveUp"),
KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveDown"),
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadWest"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadEast"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD6, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadNorth"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD8, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadSouth"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD2, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadNorthWest"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD7, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadNorthEast"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD9, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadSouthWest"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD1, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("MoveNumPadSouthEast"),
KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD3, 0), WHEN_FOCUSED );
registerKeyboardAction(new NewAction("CtrlEnter"),
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, Event.CTRL_MASK), WHEN_FOCUSED
);
registerKeyboardAction(new NewAction("Control"),
KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, Event.CTRL_MASK),
WHEN_FOCUSED );
}
}

Like I said, I don't see anything wrong with it. It certainly works when
used in an application. If you have had similar problem and know of a
workaround, please let me know.

Regards,

Alan Shiers