when the program run this line
s = f.load("1.wrl");
I'm using Win98 and the vrml file"1.wrl" was not "Protected" or "READ ONLY". Did you know what's the problem? Thanks.
Martin Chan
public class Load2 extends Applet {
public BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
VrmlLoader f = new VrmlLoader();
Scene s = null;
try {
s = f.load("1.wrl");
} catch(FileNotFoundException e){
System.err.println(e);
System.exit(1);
} catch (ParsingErrorException e){
System.err.println(e);
System.exit(1);
} catch (IncorrectFormatException e){
System.err.println(e);
System.exit(1);
}
objRoot.addChild(s.getSceneGroup());
return objRoot;
}
public Load2() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config);
add("Center", c);
BranchGroup scene = createSceneGraph();
SimpleUniverse u = new SimpleUniverse(c);
u.getViewingPlatform().setNominalViewingTransform();
u.addBranchGraph(scene);
}
public static void main(String[] args) {
new MainFrame(new Load2(), 500, 500);
}
}
