• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!