Hai Ning wrote:
>
> does anyone know if Java3D works with Swing? it seems
> i can not add canvas3D to a Swing panel.
> any thought?
>
> thanks.
>
> -Hai
>

Hi Hai,
yes,  you can incorporate Java3D and Swing. You can
definitely extend JFrame to hold a 3DCanvas.

Best regards
               Joerg


Take a look:

import javax.swing.JFrame;
import javax.media.j3d.*;
import java.awt.*;
import java.awt.event.*;

public class Canvas3DFrame extends JFrame  {
 Canvas3D canvas;
 Container contentpane;

 public Canvas3DFrame(String name,int x,int y,int h,int w){
 super(name);
 this.setBounds(x,y,h,w);
 this.addWindowListener(new WindowAdapter() {
                                        public void windowClosing(WindowEvent
e){
                                                System.exit(0);
                                        }});

  contentpane = this.getContentPane();
  canvas = new
Canvas3D(com.sun.j3d.utils.universe.SimpleUniverse.getPreferredConfiguration());
  contentpane.add(canvas);
  this.show();
  }

//    public static void main(String args[]){
//      JFrame  frame = new Canvas3DFrame(args[0],Integer.parseInt(args[1]),
//Integer.parseInt(args[2]),Integer.parseInt(args[3]),Integer.parseInt(args[4]));
//   }
}

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