I implement the workaround you suggested:
canvas3D.addKeyListener( new KeyControls( frame ) );
Notice I pass my menu container, in this case a JFrame, to the constructor
of the listener (KeyControls class).
My KeyControls is similar to the one you can find in the J3DFly source code,
but instead of handling any KeyEvents right there, I have
public void keyPressed(final java.awt.event.KeyEvent evt) {
// forward it to the frame
frame.dispatchEvent(evt);
}
Now, even if the canvas3D has focus, both menu accelerators and mnemonic's
work. I'm not sure, but as far as I know this will not mess up the normal
event thread.
--Kevin
> -----Original Message-----
> From: Joachim Diepstraten
>
> Hi
>
> > What is the best way to forward the keyboard focus, or
> keyboard events, to
> > the Swing components?
> Well you could add a keylistener in your Canvas and forward
> those events
> to the menu-container but I'm not 100% sure if this would work.
>
> EOF,
> J.D.
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".