hi
I’m trying to catch mouse events from the AWT Toolkit. Motion events work great as well as button events. Unfortunately wheel events are blocked by the GLCanvas. Is this a bug or a feature and is there a workaround/fix for it?
Here is my test case:
import java.awt.AWTEvent;
import java.awt.Toolkit;
import java.awt.event.AWTEventListener;
import javax.media.opengl.GLCanvas;
import javax.swing.JFrame;
public class AWTMouseWheelTest extends JFrame implements AWTEventListener
{
private static final long serialVersionUID = 1L;
public void eventDispatched(AWTEvent event)
{
System.out.println( event );
}
public AWTMouseWheelTest()
{
super( "sdfsdf" );
this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
this.setBounds( 100, 100, 640, 480 );
this.getContentPane().setLayout( null );
GLCanvas canvas = new GLCanvas();
canvas.setBounds( 10, 10, 100, 100 );
this.getContentPane().add( canvas );
System.out.println( canvas.getMouseWheelListeners().length );
Toolkit.getDefaultToolkit().addAWTEventListener( this, AWTEvent.MOUSE_WHEEL_EVENT_MASK );
this.setVisible( true );
}
}
Any help is appreciated.
Marvin