drawing a cube

I am a begginer and I am trying to draw a cube with opengl in java,for that I tried to modify your source posted in tutorials for begginers, that “hello
demo” but does nothing. I want to draw the cube using glutWireCube. Could anyone show me an example for that?

Not sure which tutorial you are referring to, AFAIK opengl.org does not host tutorials directly, but there is a list of them on the wiki. I would recommend picking one of those targeting OpenGL 3.0.
Please note that your problem description is not very helpful, so it’s not really possible to help, take a look at the [thread=176139]Forum Posting Guidelines[/thread] for suggestions what information to include/how to ask questions.

package glredbook10;

import java.awt.BorderLayout;
import java.awt.Frame;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;

import com.sun.opengl.util.Animator;
import com.sun.opengl.util.GLUT;

public class robot extends Frame implements GLEventListener{

public robot() {
    super("Basic JOGL Demo");

    setLayout(new BorderLayout());
   // addWindowListener(this);

    setSize(600, 600);
    setLocation(40, 40);

    setVisible(true);

    setupJOGL();
}

public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();

gl.glClearColor(0, 0, 0, 0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glOrtho(0, 1, 0, 1, -1, 1);
}

public void reshape(GLAutoDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height) {
}

public void displayChanged(GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged) {
}

public void display(GLAutoDrawable drawable) {

GL gl = drawable.getGL();
GLUT glut=new GLUT();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glColor3f(1, 0, 0);
glut.glutWireCube(14.0f);
gl.glFlush();
}

private void setupJOGL(){
GLCapabilities caps = new GLCapabilities();
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
GLCanvas canvas = new GLCanvas(caps);
canvas.addGLEventListener(this);

add(canvas, BorderLayout.CENTER);

Animator anim = new Animator(canvas);
anim.start();

}

public static void main(String[] args) {
    robot demo = new robot();
    demo.setVisible(true);
}

}
But it does display nothing , why?

Please use [noparse]


[/noparse] around source snippets.
Is this code unmodified from the tutorial? There are some oddities in it, for example the orthographic projection matrix should normally be put on the GL_PROJECTION matrix stack. Also, your orthographic projection only projects objects in the [0,0,-1] x [1,1,1] world coordinate cube onto the screen, but your wire cube is entirely outside this volume.