package demos; import java.util.*; import java.lang.reflect.*; import javax.media.opengl.*; import javax.media.nativewindow.*; import com.sun.javafx.newt.*; import com.sun.javafx.newt.opengl.*; public class GLNewtRun implements WindowListener, KeyListener, MouseListener { static GLWindow window; static volatile boolean quit = false; public void windowResized(WindowEvent e) { } public void windowMoved(WindowEvent e) { } public void windowGainedFocus(WindowEvent e) { } public void windowLostFocus(WindowEvent e) { } public void windowDestroyNotify(WindowEvent e) { quit = true; } public void keyPressed(KeyEvent e) { System.out.println(e); if(e.getKeyChar()=='f') { window.setFullscreen(!window.isFullscreen()); } else if(e.getKeyChar()=='q') { quit = true; } } public void keyReleased(KeyEvent e) { System.out.println(e); } public void keyTyped(KeyEvent e) { System.out.println(e); } public void mouseClicked(MouseEvent e) { System.out.println(" mouseevent: "+e); switch(e.getClickCount()) { case 1: if(e.getButton()>MouseEvent.BUTTON1) { window.setFullscreen(!window.isFullscreen()); } break; default: quit=true; break; } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseMoved(MouseEvent e) { } public void mouseDragged(MouseEvent e) { } public void mouseWheelMoved(MouseEvent e) { } public boolean shouldQuit() { return quit; } public static int str2int(String str, int def) { try { return Integer.parseInt(str); } catch (Exception ex) { ex.printStackTrace(); } return def; } public static void main(String[] args) { boolean parented = false; boolean useAWTTestFrame = false; boolean useAWT = false; boolean undecorated = false; boolean fullscreen = false; int x_p = 0; int y_p = 0; int x = 0; int y = 0; int width = 800; int height = 480; String glProfileStr = null; if(0==args.length) { throw new RuntimeException("Usage: "+GLNewtRun.class+" "); } GLNewtRun listener = new GLNewtRun(); int i=0; while(i