Salut,

si je me rappel bien cela est du a cause de Panel.
JPanel marche pour moi, essaye avec JPanel.


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();
contentPane.setLayout(new BorderLayout());
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.setLayout(new BorderLayout());
p.add(canvas3D, BorderLayout.CENTER);
contentPane.add(p, BorderLayout.CENTER);
}

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


                              \\\|///
                            \\  ~ ~  //
                             (  @ @  )
 --------------------------oOOo-(_)-oOOo--------------------------------

      _/_/_/_/  _/_/_/_/  _/_/_/_/_/  _/_/_/_/   Eric Malguy
     _/        _/    _/      _/      _/         Software Engineer
    _/_/_/_/  _/_/_/_/      _/      _/        Advanced Systems Group
         _/  _/    _/      _/      _/        Arlington, VA (703) 558-2994
  _/_/_/_/  _/    _/  _/_/_/_/_/  _/_/_/_/  [EMAIL PROTECTED]
 -----------------------------------Oooo.-------------------------------
                          .oooO     (   )
                          (   )      ) /
                           \ (      (_/
                            \_)


-----Original Message-----
From: Vlad Valica [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 09, 2000 4:48 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] canvas3D into Panel


Hello!

I'd like to know how can I put a canvas3D into a panel. I have an object
3D (wrl) into a canvas3D and I need to putthe canvas3D into a panel. I
tried to put the canvas into a frame and it's OK. I can see it. But if I
try to put it into a Panel and after into a frame I see nothing.

For example:
if I have canvas3d

Frame fram = new Frame();
fram.add(canvas3d);
fram.pack();
fram.setVisible(true);

this it's OK and I can handle my wrl object.

On the other side if I consider the same example in which I changed:

Frame fram = new Frame();
Panel pan = new Panel();
pan.add(canvas3d);
fram.add(pan);
fram.pack();
fram.setVisible(true);

In this case I see nothing but it is a display problem because all the
functions goes well.

I really need to have this canvas into my panel and I don't know how to do
this.

Please help me if you can!

Vlad

*********************************************
*                                           *
* Vlad Valica                               *
* email: [EMAIL PROTECTED]
* tel:  bureau: 01.60.76.47.02              *
*               01.60.76.44.37              *
*       maison: 01.60.76.64.47              *
*                                           *
*                                           *
*********************************************

===========================================================================
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".

===========================================================================
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".

Reply via email to