Hi,
I've got a problem viewing my applet. I can't find any mistake into the code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GraphicsConfiguration; import javax.media.j3d.BranchGroup; import javax.media.j3d.Canvas3D; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.universe.*; import com.sun.j3d.utils.geometry.ColorCube; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.media.j3d.*; import javax.vecmath.*;
public class HelloJava3Da extends Applet { public HelloJava3Da() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup scene = createSceneGraph(); scene.compile(); SimpleUniverse simpleU = new SimpleUniverse(canvas3D); simpleU.getViewingPlatform().setNominalViewingTransform(); simpleU.addBranchGraph(scene); } public BranchGroup createSceneGraph() { BranchGroup objRoot = new BranchGroup(); objRoot.addChild(new ColorCube(0.4)); return objRoot; } public static void main(String[] args){ Frame frame = new MainFrame(new HelloJava3Da(), 256, 256); } } |
But I am a newbie. I think there's a browser problem. I am working with eclipse 3.1. The applet viever shows the applet [example Java3Da] But I don't see a cube. And I didn't get an error message into my eclipse console. If I try to open another applet with firefox 1.0 I get the following message:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| java.lang.VerifyError: (class: HexColor, method: keyDown signature: (Ljava/awt/Event;I)Z) Unsorted lookup switch
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) |
Does anybody know the problem?
thank you,
bolshi