• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

java 3D error - help.  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can compile a program called StartCube.java, but when I type
java StartCube
on the command line, it will open a window with nothing in it. However it works on the schools computer. What did I do wrong? Here is the code:
// creates a universe with nothing in it.
import java.awt.*;
import java.awt.event.*;
import javax.media.j3d.*;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
public class StartCube extends Frame {
public static void main(String[] args) {
StartCube frame = new StartCube("StartCube");
frame.setSize(300,200);
frame.setVisible(true);
}
public StartCube(String title) {
super(title);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Canvas3D canvas = new Canvas3D(null);
add(canvas,"Center");
SimpleUniverse universe = new SimpleUniverse(canvas);
universe.getViewingPlatform().setNominalViewingTransform();
BranchGroup root = new BranchGroup();
ColorCube cube = new ColorCube(.5);
root.addChild(cube);
universe.addBranchGraph(root);
}
}
this code is right because it works on the computer at school. i have windows 2000 OS, using OpenGL java 3D API and Runtime environment.
please help.
thanks....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!