I don't subscribe 100% at this....
Take a look at the two files attached, this is a portion of an application I wrote that
really works.
Vladimir Olenin wrote:
> I guess u ran across the same notorious issue: heavyweight components
> vs. lightweight ones. The latter are always overlapped by the former,
> no matter what the Z order is. Canvas3D is a heavyweight comp, while
> all Swing components are the light ones.
>
> I guess that's where your problem is.
>
> vladimir
> -=V=-
> >-------<=============>-------<
> Join in Java community now!
> http://JavaCafe.VirtualAve.net/
> >-------<=============>-------<
>
> In your previous letter u wrote:
> --------------------------------
> SS> Hello,
>
> SS> Attached is a short program that should (as far as I know) implement
> SS> a java3d window as a JPanel. However, it does not.
> SS> Any suggestions.
>
> SS> Steve
>
> SS> //////////////////////////////////////////////////////////////
> SS> //////////////////////////////////////////////////////////////
> SS> import java.awt.*;
> SS> import java.awt.event.*;
> SS> import java.awt.event.WindowAdapter;
> SS> import javax.swing.*;
> SS> import javax.swing.JFrame;
>
> SS> public class MethodView extends JFrame {
>
> SS> Container contentpane;
> SS> protected JPanel ivjJPanel1 = null;
>
> SS> MethodNode MethodRoot = new MethodNode();
>
> SS> public MethodView(String name,int x,int y,int h,int w)
> SS> {
> SS> super(name);
> SS> this.setBounds(x,y,h,w);
>
> SS> this.addWindowListener(new WindowAdapter() {
> SS> public void windowClosing(WindowEvent
>e){
> SS> System.exit(0);
> SS> }});
>
> SS> contentpane = this.getContentPane();
>
> SS> MethodPanel3D methPanel = new MethodPanel3D();
> SS> contentpane.add("Center",methPanel);
>
> SS> this.show();
> SS> }
>
> SS> public static void main(String[] args)
> SS> {
> SS> JFrame frame = new MethodView("Test for Java3D panel",50,50,500,500);
> SS> }
> SS> }
> SS> //////////////////////////////////////////////////////////////
> SS> //////////////////////////////////////////////////////////////
> SS> import javax.swing.*;
> SS> import java.awt.*;
> SS> import java.awt.event.*;
>
> SS> import com.sun.j3d.utils.universe.*;
> SS> import com.sun.j3d.utils.geometry.*;
> SS> import javax.media.j3d.*;
> SS> import javax.vecmath.*;
>
> SS> import com.sun.j3d.utils.geometry.ColorCube;
>
> SS> class MethodPanel3D extends JPanel
> SS> {
> SS> Canvas3D canvas;
>
> SS> public MethodPanel3D()
> SS> {
> SS> setOpaque(false);
>
> SS> canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
> SS> BranchGroup scene = createSceneGraph();
> SS> SimpleUniverse u = new SimpleUniverse(canvas);
> SS> u.getViewingPlatform().setNominalViewingTransform();
> SS> u.addBranchGraph(scene);
>
> SS> add("Center",canvas);
>
> SS> }
>
> SS> public BranchGroup createSceneGraph()
> SS> {
> SS> BranchGroup objRoot = new BranchGroup();
>
> SS> objRoot.addChild( new ColorCube(0.4) );
>
> SS> return objRoot;
> SS> }
>
> SS> /*
> SS> public void paintComponent(Graphics g)
> SS> {
> SS> super.paintComponent(g);
> SS> g.drawString("test",50,50);
> SS> }
> SS> */
>
> SS> }
> SS> //////////////////////////////////////////////////////////////
> SS> //////////////////////////////////////////////////////////////
>
> SS> ===========================================================================
> SS> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> SS> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> SS> [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".
--
Best regards,
Dan Todor
---
You can have it done FAST | \
You can have it done RIGHT | | --- Pick any two.
You can have it done CHEAP | /
VisuApp.java
VisuPanel.java