Simple lwjgl applet

Can some one show me simple lwjgl applet that uses Display.setParent()?
Or help find me error in this sample, i have only black screen:


import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;

public class LWJGLapplet extends Applet {
   
   Canvas display_parent;
   Thread gameThread;
   
   boolean running = false;

   public void destroy() {
      super.destroy();
      running = false;
      System.out.println("*** destroy ***");
   }

   public void start()
   {
      super.start();
      System.out.println("*** start ***");
      gameThread = new Thread()
      {
         public void run()
         {
            running = true;
            try
            {
               System.out.println("display_parent.isDisplayable() = " + display_parent.isDisplayable());
               Display.setParent(display_parent);
               //Display.setVSyncEnabled(true);
               Display.create();
            }
            catch (LWJGLException e)
            {
               e.printStackTrace();
            }
            //gameLoop();
            while(true)
            {
        	          	Display.update();
            	render();            	
            }
         }
      };
      gameThread.start();
   }
   
   private void render() 
   {
	    // clear the screen
	    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
	 
	    // center square according to screen size
	    GL11.glPushMatrix();
	    GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
	 
	      // rotate square according to angle
	      GL11.glRotatef(0.05f, 0, 0, 1.0f);
	      GL11.glBegin(GL11.GL_QUADS);
	        GL11.glVertex2i(-50, -50);
	        GL11.glVertex2i(50, -50);
	        GL11.glVertex2i(50, 50);
	        GL11.glVertex2i(-50, 50);
	      GL11.glEnd();
	 
	    GL11.glPopMatrix();
   }

   public void stop() {
      super.stop();
      System.out.println("*** stop ***");
   }

   public void init()
   {
      setLayout(new BorderLayout());
      try {
         display_parent = new Canvas() {
            public final void removeNotify() {
               super.removeNotify();
            }
         };
        
         display_parent.setSize(getWidth(),getHeight());
         add(display_parent);
         display_parent.setFocusable(true);
         display_parent.requestFocus();
         //display_parent.setIgnoreRepaint(true);
         //setResizable(true);
         setVisible(true);
      } catch (Exception e) {
         System.err.println(e);
         throw new RuntimeException("Unable to create display");
      }
   }
}

i am not sure. but I think taht you need GLU here is how to use it. Use it when you initiate GL

GLU.gluPerspective(
45.0f,
(float) displayMode.getWidth() / (float) displayMode.getHeight(),
0.1f,
100.0f);

u muse import this : org.lwjgl.util.glu.GLU;

I dont know if this works the same with applets, but it should. tell me if it works.

GL

EDIT: I was juse going through your code. you never initiate GL. you did some other stuff I dont know, taht may have initiated it.

Have a look at the GearsApplet example, it shows the best way to run an lwjgl applet using Display.setParent() it can be found with the lwjgl source code or on svn at http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/LWJGL/src/java/org/lwjgl/test/applet/GearsApplet.java?view=markup also have a look if the lwjgl applet over at http://www.lwjgl.org/applet works for you.

Thanks, it helped me.