Hi, guys,
Please please help me. I am using JavaSWING and java3D. I try to put
Canvas3D colorCube into a JPanel, but the colorCube doesn't show up in the
frame. the code is as following: PLEASE PLEASE HELP ME!!!
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.*;
import javax.vecmath.*;
import javax.swing.*;
import java.awt.*;
public class HelloJava3Da extends JApplet
{
public HelloJava3Da() {
Container contentPane = getContentPane();
Button b = new Button("button");
contentPane.add(b, BorderLayout.NORTH);
//Creating a color cube
Canvas3D canvas3D = new Canvas3D(null);
BranchGroup scene = createSceneGraph();
scene.compile();
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
simpleU.getViewingPlatform().setNominalViewingTransform();
simpleU.addBranchGraph(scene);
//put the canvas into a JPanel, add panel into contentPane
JPanel p = new JPanel();
p.add(canvas3D, BorderLayout.CENTER);
contentPane.add(p, BorderLayout.SOUTH);
}
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);
}
} // end of class HelloJava3Da
grace
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".