

import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;

import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;

/**
 * This sample demonstrates that when the user rolls the mouse wheel,
 * instead of calling mouseWheelMoved(), the methods mousePressed() and
 * mouseReleased() are called.
 */

public class TestNewt {

	public static void main(String[] args) {
		new TestNewt();
	}
	
	public TestNewt() {
		
        GLProfile.initSingleton();
        GLProfile glp = GLProfile.getDefault();
        GLCapabilities caps = new GLCapabilities(glp);

        GLWindow window = GLWindow.create(caps);
        window.setSize(600, 300);
        window.setVisible(true);
        window.setTitle("TestNewt : Roll the wheel of your mouse :)");

        window.addWindowListener(new WindowAdapter() {
            public void windowDestroyNotify(WindowEvent arg0) {
                System.exit(0);
            };
        });
        
        window.addMouseListener(new MouseAdapter() {

        	public void mousePressed(MouseEvent arg0) {
        		System.out.println("mousePressed");
        	}

        	public void mouseReleased(MouseEvent arg0) {
        		System.out.println("mouseReleased");
        	}

        	public void mouseWheelMoved(MouseEvent arg0) {
        		System.out.println("mouseWheelMoved");
        	}
        }
        );
	}

}
