Dissappearing mouse events!

Hi,

I’m having a few problems with mouse events. If I create a new Frame then I can trap mouse events 504 and 505 when the mouse moves in and out of the window using processEvent(). However, if I create a Frame and attach a GLCanvas to it, the mouse events appear to be consumed by GLCanvas somehow. At least they never appear in processEvent().

Here’s my initialisation for the Frame etc:

View view = new View(); // View extends Frame
GLCapabilities capabilities = new GLCapabilities();
capabilities.setSampleBuffers(true);
capabilities.setNumSamples(2);
GLCanvas canvas = new GLCanvas(capabilities);
canvas.addGLEventListener(view);
view.add(canvas);
view.setSize(100,100);
view.pack();
view.setVisible(true);
view.setLocation(200,0);
final Animator animator = new Animator(canvas);
view.setVisible(true);
animator.start();

If I comment out the line

//view.add(canvas);

then the mouse events appear correctly.

Does anyone know if there is a way to trap these events, or perhaps I’m am doing something wrong in the setup?
Ultimately, I want to be able to detect if the mouse is in the window or not and only respond to mouse movement if it is. Does anyone know if I’m going about this the right way?

Thanks in advance,
Chris.

Have you tried adding a MouseListener to the GLCanvas?

No, I hadn’t - but that works fine.
Thanks!