Reply – Re: Java3D Adding KeyListener to Canvas. Key Dont Fire.
Your Name
or Cancel
In Reply To
Re: Java3D Adding KeyListener to Canvas. Key Dont Fire.
— by philjord philjord
Hi Andrew,
Thanks for raising this issue. I'm based on windows and don't have access to a MacOS device, so I'm going to be much less useful to you than I'd like to be.

Firstly if you can post the sample code that shows the problem that will help me to focus on the right areas when trying to track this down.

Next there hasn't been any change to the key listener code in Java3D for many years so I'm going to assume the specific version you've been given won't be the problem, I'll be working on these jars 
(and the source code for those jars java3d, linked there)

Finally the key listeners for Canvas3D are inherited from Component, and not touched in anyway (which you can verify by looking at the source of Canvas3D) though it forwards events from it's EventCatcher to the behaviour scheduler so java3d behaviors can trigger on AWTEvents

Please note in Canvas3D this comment:
     * This method overrides AWT's handleEvent class...
    void sendEventToBehaviorScheduler(AWTEvent evt) {

Is over 15 years old and was only accurate in the Java 1.1 event model, so I should probably update it one day.

In order to investigate key events outside of Canvas3D could you set up the same tests with a simple JPanel and key listener with the rest of the test setup unchanged and confirm they are responding when you expect them to?

Once you've confirmed that (and provided a simple test code for me) I'll work out the next steps