There is a discussion of this in the "How To" section of the Java 3D FAQ.

http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html


"Hock, Gregg" wrote:

> Hi again everyone,
> I tried the archived solutions to this problem but without any luck.
> Does anyone have a solution for using JMenuBar, Jmenu and JMenuItem(s) in
> Java3D (app or applet)?
> My problem is with getting the JMenuItems to appear.  Is the Canvas3D the
> culprit or Java3D in general?
>
> Relevant source code as follows:
>
> public MyStuff() {
>   setLayout(new BorderLayout());
>   Canvas3D c = new Canvas3D(null));
>    add("Center", c);
>
>   JMenuBar menubar = new JMenuBar();
>   JMenuItem mi = new JMenuItem();
>
>   JMenu file = (JMenu) menubar.add(new JMenu("File"));
>   mi = (JMenuItem)file.add(new JMenuItem("Open"));
>  mi = (JMenuItem)file.add(new JMenuItem("Save")):
>
> add(menubar);
>
> //Create a simple cube scene
> BranchGroup scene = createSceneGraph();
>
> SimpleUniverse su = new SimpleUniverse(c);
>
> su.addBranchGroup(scene;
>
> }
>
> main() {
> MyStuff ms = new MyStuff();
> ms.init();
> Jframe frame = new Jframe("Hello");
> frame.setSize(256,256);
> frame.getContentPane().add("Center", ms);
> frame.setLocation(100,100);
> frame.setVisible(true);
> }
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/

--
Steve Pietrowicz - [EMAIL PROTECTED]    Project Manager - NCSA Java 3D Group

NCSA Portfolio:      http://havefun.ncsa.uiuc.edu/Java3D/portfolio/
   New Beta 2a release!  New Loaders, record and replay of your
   Java 3D apps and more! Freely available for non-commercial use!
You Build It VR:     http://havefun.ncsa.uiuc.edu/Java3D/YouBuildItVR/
   Build your own multi-user virtual worlds with no programming experience!
The Java3D FAQ:      http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
Java News Network:   http://tintoy.ncsa.uiuc.edu/~srp/java/javanews.html



=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to