import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
import java.awt.BorderLayout;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 * A class to test an issue with the value returned by the getWheelRotation()
 * method of the Newt MouseEvent.
 * @author Daniel Allen
 */
public class MouseWheelError
{
    public static void main(String[] args)
    {
        GLProfile.initSingleton();
        GLProfile profile = GLProfile.getDefault();
        GLCapabilities capabilities = new GLCapabilities(profile);
        GLWindow window = GLWindow.create(capabilities);
        window.addMouseListener(new MouseWatcher());
        Animator animator = new Animator(window);
        animator.start();
        final NewtCanvasAWT newtCanvas = new NewtCanvasAWT(window);
        final JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add(newtCanvas, BorderLayout.CENTER);
        final JFrame frame = new JFrame("Miracle");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setContentPane(panel);
        frame.setSize(300, 300);
        frame.setVisible(true);
    }
    
    private static class MouseWatcher extends MouseAdapter
    {
        @Override
        public void mouseWheelMoved(MouseEvent e)
        {
            System.out.println(e.getWheelRotation());
        }
    }
}