I've attached some code, Regards, Renoir Guang Bin Liu wrote: > Hi Every One: > > I want to plot a moving thing in a pure dark area. So the JFrame is not > suitable as the top bar and frame edges are different color. I learnt that > window may be used but I failed after several try. Can you please help by > indicating what I need to do? (Let's use HelloUniverse.java as an example). > Thank you a lot! > > Best regards, > > G.B. > > <br><br><br>Guang Bin Liu > VTHRC > Univ. of Queensland > St Lucia 4072 > Brisbane, Australia > Phone: 61 7 3365 4072 > Fax: 61 7 3365 4522 > e-mail: [EMAIL PROTECTED] > [EMAIL PROTECTED] > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > =========================================================================== > 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". -- Renoir Sewjee Software Engineer ISS International (Welkom) Tel: +27 (0)57 912 2702 Fax: +27 (0)57 912 2652 --
import java.awt.Dimension; import java.awt.BorderLayout; import javax.swing.JWindow; import javax.vecmath.Point3d; import javax.media.j3d.Canvas3D; import javax.media.j3d.BranchGroup; import javax.media.j3d.BoundingSphere; import javax.media.j3d.Background; import javax.media.j3d.Material; import javax.media.j3d.Appearance; import javax.media.j3d.DirectionalLight; import javax.media.j3d.AmbientLight; import com.sun.j3d.utils.universe.SimpleUniverse; import com.sun.j3d.utils.geometry.Sphere; import com.sun.j3d.utils.behaviors.vp.OrbitBehavior; public class FullWindowCanvas3D extends JWindow { public FullWindowCanvas3D() { super(); BoundingSphere everywhere = new BoundingSphere(new Point3d(), Double.MAX_VALUE); Canvas3D canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); canvas.setDoubleBufferEnable(true); getContentPane().add(canvas, BorderLayout.CENTER); SimpleUniverse universe = new SimpleUniverse(canvas); universe.getViewingPlatform().setNominalViewingTransform(); BranchGroup lights = new BranchGroup(); DirectionalLight directionalLight = new DirectionalLight(); directionalLight.setInfluencingBounds(everywhere); lights.addChild(directionalLight); AmbientLight ambientLight = new AmbientLight(); ambientLight.setInfluencingBounds(everywhere); lights.addChild(ambientLight); universe.getViewingPlatform().getViewPlatformTransform().addChild(lights); BranchGroup root = new BranchGroup(); Background background = new Background(0, 0, 0); background.setApplicationBounds(everywhere); root.addChild(background); Material sphereMaterial = new Material(); sphereMaterial.setDiffuseColor(0, 0, 1); Appearance sphereAppearance = new Appearance(); sphereAppearance.setMaterial(sphereMaterial); root.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS, sphereAppearance)); OrbitBehavior orbitter = new OrbitBehavior(canvas); orbitter.setSchedulingBounds(everywhere); orbitter.setViewingPlatform(universe.getViewingPlatform()); root.addChild(orbitter); root.compile(); universe.addBranchGraph(root); } public static void main(String[] args) { FullWindowCanvas3D win = new FullWindowCanvas3D(); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); win.setSize(screenSize.width, screenSize.height); win.setVisible(true); } }