import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.*;
import javax.media.nativewindow.*;

public class SimpleTest implements GLEventListener {

    public static void main(String[] args) {
	System.err.println("#SimpleTest:  Calling: GLProfile.getDefault()");
        GLProfile glp = GLProfile.getDefault();
	
	System.err.println("#SimpleTest:  Calling: new GLCapabilities(glp)");
        GLCapabilities caps = new GLCapabilities(glp);
	
	System.err.println("#SimpleTest:  Calling: new GLCanvas(caps)");
        final GLCanvas canvas = new GLCanvas(caps);

	System.err.println("#SimpleTest:  Calling: new Frame(\"Test\")");
        final Frame frame = new Frame("Test");
	
	System.err.println("#SimpleTest:  Calling: frame.setSize(300, 300)");
        frame.setSize(300, 300);
	
	System.err.println("#SimpleTest:  Calling: addWindowListener(new WindowAdapter()");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
		System.err.println("#SimpleTest:  Calling: e.getWindow().dispose()");
		e.getWindow().dispose();
		System.err.println("#SimpleTest:  Calling: System.exit(0)");
                System.exit(0);
            }
        });
	
	System.err.println("#SimpleTest:  Calling: canvas.addGLEventListener(new SimpleTest())");
        canvas.addGLEventListener(new SimpleTest());
	
	System.err.println("#SimpleTest:  Calling: frame.add(canvas)");
        frame.add(canvas);
	
	System.err.println("#SimpleTest:  Calling: frame.setVisible(true)");
        frame.setVisible(true);
    }
    public void display(GLAutoDrawable drawable) {
        drawable.getGL().getGL2().glClear(GL.GL_COLOR_BUFFER_BIT);
    }
    public void dispose(GLAutoDrawable drawable) { }
    public void init(GLAutoDrawable drawable) { }
    public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { }
}
