Xith3D in a JPanel - Simple example(s)

Hi there! I’m looking to combine Xith3D and another toolkit (for non-graphics work) and I want to put everything in one regular Java window - a JPanel as far as I know (I’m fairly new to Java). I’d like to put other normal GUI widgets inside the one window and have a 3D area as part of that.

The sample code “Swing” in the getting started examples has Swing components inside the Xith3D render window, and the Magicosm GUI test example appears to be Xith3D inside a JPanel but is very full on and integrated with lots of other features.
Are there any simple examples that show this or is there something else I should know to achieve this end?
Thanks,
Lindsay

The com.xith3d.userinterface package can be used to place swing widgets inside a xith3d frame. however it is very buggy and slow. The better solution is to use the Foreground node, possibly using one of the newer UI packages: http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1097928552;start=30#30

Xith3D can also be placed inside a JPanel, allowing other widgets to be placed around it.

Example using a specified JFrame:


            // Creates the canvas
            RenderPeer rp = new RenderPeerImpl();
            rootFrame = new JFrame();
            
            
            cp = rp.makeCanvas(rootFrame.getContentPane(),firespite.canvasWidth,firespite.canvasHeight,firespite.bitDepth,false);
            canvas = new Canvas3D();
            canvas.set3DPeer(cp);
            canvas.setView(new View());
            view.addCanvas3D(canvas);


Example using a specified JFrame & JPanel:


            RenderPeer rp = new RenderPeerImpl();
            rootFrame = new JFrame();
            
            JPanel p = new JPanel();
            rootFrame.getContentPane().add(p);
            cp = rp.makeCanvas(p,firespite.canvasWidth,firespite.canvasHeight,firespite.bitDepth,false);
            canvas = new Canvas3D();
            canvas.set3DPeer(cp);
            canvas.setView(new View());
            view.addCanvas3D(canvas);

I did reply to your email btw - didn’t you get it?

Will.