package org.lwjgl.opengl.awt;

import java.awt.BorderLayout;
import static org.lwjgl.opengl.GL.*;
import static org.lwjgl.opengl.GL11.*;
import javax.swing.JFrame;

public class AWTTest {
	public static void main(String[] args) {
		JFrame frame = new JFrame("AWT test");
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frame.setLayout(new BorderLayout());
		GLData data = new GLData();
		data.samples = 4;
		frame.add(new AWTGLCanvas(data) {
			public void initGL() {
			    createCapabilities();
			    glClearColor(0.3f, 0.4f, 0.5f, 1);
			}
			public void paintGL() {
			    int w = getWidth();
			    int h = getHeight();
			    float aspect = (float)w/h;
			    glClear(GL_COLOR_BUFFER_BIT);
			    glViewport(0, 0, w, h);
			    glBegin(GL_QUADS);
			    glColor3f(0.4f, 0.6f, 0.8f);
			    glVertex2f(-0.5f / aspect, 0.0f);
			    glVertex2f(0, -0.5f);
			    glVertex2f(+0.5f / aspect, 0);
			    glVertex2f(0, +0.5f);
			    glEnd();
			    swapBuffers();
			    this.repaint();
			}
		}, BorderLayout.CENTER);
		frame.setVisible(true);
	}
}

@@ -54,16 +54,44 @@
 Layout;%0A
+import java.awt.Dimension;%0A%0A
 import s
@@ -154,24 +154,25 @@
 ngl.GL11.*;%0A
+%0A
 import javax
@@ -391,16 +391,67 @@
 out());%0A
+%09%09frame.setPreferredSize(new Dimension(600, 600));%0A
 %09%09GLData
@@ -1106,16 +1106,32 @@
 ENTER);%0A
+%09%09frame.pack();%0A
 %09%09frame.

Set preferred size