package cg; //------------------------------------------------------------------------------------------ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLCapabilities; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.FPSAnimator; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyListener; import com.jogamp.newt.event.MouseEvent; import com.jogamp.newt.event.MouseListener; //------------------------------------------------------------------------------------------ public class Main implements KeyListener, MouseListener { //... //------------------------------------------------------------------------------------------ public static void main(String[] args) { //... GLProfile glp = GLProfile.getDefault(); GLCapabilities caps = new GLCapabilities(glp); GLWindow window = GLWindow.create(caps); window.setSize(640, 480); window.setTitle("NEWT Fenster"); window.setVisible(true); Main mn = new Main(); window.addKeyListener(mn); window.addMouseListener(mn); //... final FPSAnimator animator = new FPSAnimator(window, 60, true); animator.start(); } //------------------------------------------------------------------------------------------ public void keyPressed(KeyEvent e) {System.out.println(e.getKeyChar());} public void keyReleased(KeyEvent e) {/*...*/} //------------------------------------------------------------------------------------------ public void mouseClicked(MouseEvent e) {System.out.println(e.getClickCount());} public void mouseEntered(MouseEvent e) {System.out.println(e.getWhen());} public void mouseExited(MouseEvent e) {System.out.println(e.getWhen());} public void mousePressed(MouseEvent e) {/*...*/} public void mouseReleased(MouseEvent e) {/*...*/} public void mouseMoved(MouseEvent e) {/*...*/} public void mouseDragged(MouseEvent e) {System.out.println(e.getEventType());} public void mouseWheelMoved(MouseEvent e) {System.out.println(e.getRotation()[1]);} }