• 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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....
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!