Try to set this code in this two places. To more understand this process read this: http://java.sun.com/products/jfc/tsc/articles/mixing/
class J3DTOOL extends JFrame implements ActionListener { JPanel painel1, painel2, painel3, painel4;//paineis para cada visao de camera GridBagLayout grid; Container c; JToolBar toolbar,toolbar2; GridBagConstraints posicao; MyButton b1,b2,b3,b4,b5,make; WindowAdapter adapter; JMenuBar mbar; JMenu file,edit,window,help; JMenuItem exit,open,newer,imports,export,copy,paste,cut,wTop,wLeft,wFront,wPerspective ,ind ex,topics; JLabel top,perspective,left,front; Canvas3D cTop,cFront,cLeft,cPerspective; VirtualUniverse universe; Locale locale; View vFront,vPerspective,vLeft,vTop; BranchGroup rootTop,rootPerspective,rootLeft,rootFront; TransformGroup tColorCube,tSphere,tCylinder; J3dPrimitive primitivas; Textures texture; Lights luzes; Cameras cameras; Properties propriedades; Code code; J3DTOOL() { this.setResizable(false); Toolkit toolkit = this.getToolkit(); Dimension winSize = toolkit.getScreenSize(); this.setSize(((winSize.width*70)/100),(winSize.height*95)/100); this.setTitle("J3D TOOL MAX - ProjetoCena.j3d"); this.setLocation(((winSize.width*15)/100),0); c= this.getContentPane(); grid = new GridBagLayout(); c.setLayout(grid); posicao = new GridBagConstraints(); mbar = new JMenuBar(); this.setJMenuBar(mbar); -------------> JPopupMenu.setDefaultLightWeightPopupEnabled(false); -------------> ToolTipManager.sharedInstance().setLightWeightPopupEnabl(false); file = new JMenu("Arquivo"); file.setMnemonic('A'); edit = new JMenu("Editar"); edit.setMnemonic('E'); cut = new JMenuItem("Recortar"); cut.setMnemonic('R'); paste = new JMenuItem("Colar"); paste.setMnemonic('C'); copy = new JMenuItem("Copiar"); copy.setMnemonic('P'); edit.add(copy); edit.add(cut); edit.add(paste); exit = new JMenuItem("Salvar"); exit.setMnemonic('S'); open = new JMenuItem("Abrir"); open.setMnemonic('A'); newer = new JMenuItem("Novo"); newer.setMnemonic('N'); imports = new JMenuItem("Importar código Java 3D"); imports.setMnemonic('I'); export = new JMenuItem("Exportar para código Java 3D"); export.setMnemonic('E'); window = new JMenu("Zoom"); window.setMnemonic('Z'); wLeft = new JMenuItem("Visão esquerda"); wLeft.setMnemonic('E'); wTop = new JMenuItem("Visão aérea"); wTop.setMnemonic('A'); wPerspective = new JMenuItem("Visão em perspectiva"); wPerspective.setMnemonic('P'); wFront = new JMenuItem("Visão frontal"); wFront.setMnemonic('F'); help = new JMenu("Ajuda"); help.setMnemonic('j'); index = new JMenuItem("Índice"); index.setMnemonic('I'); topics = new JMenuItem("Tópicos"); topics.setMnemonic('T'); help.add(index); help.add(topics); window.add(wLeft); window.add(wTop); window.add(wFront); window.add(wPerspective); file.add(newer); file.add(open); //file.addSeparator(); file.add(exit); mbar.add(file); mbar.add(edit); mbar.add(window); mbar.add(help); -------------> JPopupMenu.setDefaultLightWeightPopupEnabled(true); -------------> ToolTipManager.sharedInstance().setLightWeightPopupEnabl(true); toolbar = new JToolBar(); toolbar2 = new JToolBar(); painel1 = new JPanel(); painel2 = new JPanel(); painel3 = new JPanel(); painel4 = new JPanel(); top = new JLabel("Visão Aérea"); perspective = new JLabel("Visão Perspectiva"); left = new JLabel("Visão Esquerda"); front = new JLabel("Visão Frontal"); cTop = new Canvas3D(null); cTop.setBackground(Color.black); cTop.setSize(((winSize.width*31)/100), ((winSize.height*33)/100)); painel1.add(cTop); cPerspective = new Canvas3D(null); cPerspective.setBackground(Color.red); cPerspective.setSize(((winSize.width*31)/100), ((winSize.height*33)/100)); painel2.add(cPerspective); cLeft = new Canvas3D(null); cLeft.setBackground(Color.green); cLeft.setSize(((winSize.width*31)/100), ((winSize.height*33)/100)); painel3.add(cLeft); cFront = new Canvas3D(null); cFront.setBackground(Color.blue); cFront.setSize(((winSize.width*31)/100), ((winSize.height*33)/100)); painel4.add(cFront); b1 = new MyButton("Barra de Propriedades",new ImageIcon ("Propreties.gif")); b2 = new MyButton("Geometrias",new ImageIcon("Geometry.gif")); b3 = new MyButton("Texturas",new ImageIcon("Texture.gif")); b4 = new MyButton("Luzes",new ImageIcon("Light.gif")); b5 = new MyButton("Câmeras",new ImageIcon("Camera.gif")); make = new MyButton("Gerar Código Java3D",new ImageIcon ("Make.gif")); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); make.addActionListener(this); toolbar.add(b2); toolbar.add(b3); toolbar.add(b4); toolbar.add(b5); toolbar2.add(new MyButton("Nova Cena",new ImageIcon ("Code.gif"))); toolbar2.add(b1); toolbar2.add(new MyButton("Desfazer",new ImageIcon ("Undo.gif"))); toolbar2.add(new MyButton("Refazer",new ImageIcon("Redo.gif"))); toolbar2.add(make); posicao.gridy=0; posicao.gridx=0; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=0; posicao.weighty=0; posicao.fill=GridBagConstraints.BOTH; grid.setConstraints(toolbar2,posicao); c.add(toolbar2); posicao.gridy=0; posicao.gridx=1; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=0; posicao.weighty=0; posicao.fill=GridBagConstraints.BOTH; grid.setConstraints(toolbar,posicao); c.add(toolbar); posicao.gridy=1; posicao.gridx=0; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=5; posicao.weighty=0; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(top,posicao); c.add(top); posicao.gridy=1; posicao.gridx=1; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=5; posicao.weighty=0; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(front,posicao); c.add(front); posicao.gridy=2; posicao.gridx=0; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=5; posicao.weighty=5; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(painel1,posicao); c.add(painel1); posicao.gridy=2; posicao.gridx=1; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=5; posicao.weighty=5; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(painel4,posicao); c.add(painel4); posicao.gridy=4; posicao.gridx=0; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=5; posicao.weighty=5; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(painel3,posicao); c.add(painel3); posicao.gridy=4; posicao.gridx=1; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=5; posicao.weighty=5; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(painel2,posicao); c.add(painel2); posicao.gridy=3; posicao.gridx=0; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=1; posicao.weighty=1; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(left,posicao); c.add(left); posicao.gridy=3; posicao.gridx=1; posicao.gridwidth=1; posicao.gridheight=1; posicao.weightx=1; posicao.weighty=1; posicao.fill=GridBagConstraints.NONE; grid.setConstraints(perspective,posicao); c.add(perspective); adapter = new MyWindowAdapter(this); addWindowListener(adapter); Shape3D grade1 = this.criaCenario(); Shape3D grade2 = this.criaCenario2(); universe = new VirtualUniverse(); locale = new Locale(universe); PhysicalBody corpoFrente = new PhysicalBody();//corpo fisico PhysicalEnvironment ambienteFrente = new PhysicalEnvironment ();//corpo do ambiente vFront = new View();//cria-se um view com o canvas3d atachado e seta-se o corpo fisico e o corpo do ambiente vFront.addCanvas3D(cFront); vFront.setPhysicalBody(corpoFrente); vFront.setPhysicalEnvironment(ambienteFrente); TransformGroup cameraFrente = new TransformGroup(); PhysicalBody corpoTopo = new PhysicalBody();//corpo fisico PhysicalEnvironment ambienteTopo = new PhysicalEnvironment ();//corpo do ambiente vTop= new View();//cria-se um view com o canvas3d atachado e seta-se o corpo fisico e o corpo do ambiente vTop.addCanvas3D(cTop); vTop.setPhysicalBody(corpoTopo); vTop.setPhysicalEnvironment(ambienteTopo); TransformGroup cameraTopo = new TransformGroup(); PhysicalBody corpoEsquerda = new PhysicalBody();//corpo fisico PhysicalEnvironment ambienteEsquerda = new PhysicalEnvironment ();//corpo do ambiente vLeft= new View();//cria-se um view com o canvas3d atachado e seta-se o corpo fisico e o corpo do ambiente vLeft.addCanvas3D(cLeft); vLeft.setPhysicalBody(corpoEsquerda); vLeft.setPhysicalEnvironment(ambienteEsquerda); TransformGroup cameraEsquerda = new TransformGroup(); PhysicalBody corpoPerspectiva = new PhysicalBody();//corpo fisico PhysicalEnvironment ambientePerspectiva = new PhysicalEnvironment();//corpo do ambiente vPerspective= new View();//cria-se um view com o canvas3d atachado e seta-se o corpo fisico e o corpo do ambiente vPerspective.addCanvas3D(cPerspective); vPerspective.setPhysicalEnvironment(ambientePerspectiva); vPerspective.setPhysicalBody(corpoPerspectiva); TransformGroup cameraPerspectiva = new TransformGroup(); Transform3D setFrente = new Transform3D(); Transform3D setRotacao = new Transform3D(); tColorCube = new TransformGroup(); tSphere = new TransformGroup(); tCylinder = new TransformGroup(); setFrente.set(new Vector3f(0.0f,0.0f,-0.65f)); tColorCube.addChild(new ColorCube(0.3)); tColorCube.setTransform(setFrente);//transformacao do color cube tColorCube.setCapability(TransformGroup.ALLOW_CHILDREN_READ); tColorCube.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); tColorCube.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); tColorCube.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); tColorCube.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); setFrente.set(new Vector3f(0.0f,0.0f,-3.0f)); setRotacao.rotZ(Math.PI); setRotacao.mul(setFrente); setFrente.set(new Vector3f(-0.6f,0.0f,-0.8f)); tCylinder.setTransform(setFrente); TextureLoader textura = new TextureLoader("stone.jpg",this); Appearance ap = new Appearance(); ap.setTexture(textura.getTexture()); Sphere cylinder = new Sphere(0.2f,Primitive.GENERATE_NORMALS | Primitive.GENERATE_TEXTURE_COORDS,ap); cylinder.setAppearance(ap); tCylinder.addChild(cylinder); //setFrente.set(new Vector3f(0.0f,0.0f,-3.0f)); //setRotacao.rotZ(Math.PI); //setRotacao.mul(setFrente); setFrente.set(new Vector3f(0.0f,0.6f,-0.8f)); tSphere.setTransform(setFrente); Color3f black = new Color3f(0.0f,0.0f,0.0f); Color3f white = new Color3f(1.0f,1.0f,1.0f); Color3f color = new Color3f(0.0f, 0.4f, 0.0f); ColoringAttributes ca = new ColoringAttributes(); ca.setColor(color); Appearance apc = new Appearance(); apc.setMaterial(new Material(color, color, color, color, 80.0f)); Sphere esfera = new Sphere(0.2f,apc); apc.setCapability(Appearance.ALLOW_MATERIAL_READ); apc.setCapability(Appearance.ALLOW_MATERIAL_WRITE); tSphere.addChild(esfera); tSphere.setCapability(TransformGroup.ALLOW_CHILDREN_READ); tSphere.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); tSphere.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); tSphere.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); tSphere.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); BoundingSphere bound = new BoundingSphere(new Point3d (),1000000.0);//cria um objeto do tipo boundingsphere para setar a area de atuacao da camera Color3f lightColor = new Color3f(0.7f, 0.7f, 0.7f);//cria uma cor Vector3f lightDirection = new Vector3f(-1.0f, -1.0f, - 1.0f);//cria uma direcao DirectionalLight light = new DirectionalLight(lightColor, lightDirection);//cria uma luz com cor e direcao especificados anteriormente light.setInfluencingBounds(bound);//seta a area de influencia da luz BoundingSphere bound2 = new BoundingSphere(new Point3d (),1000000.0);//cria um objeto do tipo boundingsphere para setar a area de atuacao da camera Color3f lightColor2 = new Color3f(0.7f, 0.7f, 0.7f);//cria uma cor Vector3f lightDirection2 = new Vector3f(0.0f, 0.0f, - 1.0f);//cria uma direcao DirectionalLight light2 = new DirectionalLight(lightColor, lightDirection);//cria uma luz com cor e direcao especificados anteriormente light2.setInfluencingBounds(bound);//seta a area de influencia da luz AmbientLight al = new AmbientLight(new Color3f(0.7f,0.7f,0.7f)); TransformGroup tGradeTop = new TransformGroup(); tGradeTop.addChild(tColorCube); tGradeTop.addChild(tSphere); tGradeTop.addChild(tCylinder); tGradeTop.addChild(this.criaCenario()); tGradeTop.addChild(this.criaCenario2()); tGradeTop.setTransform(setRotacao); tGradeTop.setCapability(TransformGroup.ALLOW_CHILDREN_READ); tGradeTop.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); tGradeTop.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); tGradeTop.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); tGradeTop.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); setRotacao = new Transform3D(); setFrente = new Transform3D(); setFrente.set(new Vector3f(0.1f,-3.3f,-2.5f)); setRotacao.rotZ(Math.PI/4.0); setRotacao.mul(setFrente); setFrente.rotX(Math.PI/2.7); setRotacao.mul(setFrente); cameraPerspectiva.setTransform(setRotacao); setRotacao = new Transform3D(); setFrente = new Transform3D(); setFrente.set(new Vector3f(0.0f,-2.35f,-3.5f)); setRotacao.rotZ(-Math.PI/2); setRotacao.mul(setFrente); setFrente.rotX(Math.PI/2.0); setRotacao.mul(setFrente); cameraEsquerda.setTransform(setRotacao); setRotacao = new Transform3D(); setFrente = new Transform3D(); setFrente.set(new Vector3f(0.0f,-2.3f,-3.5f)); setRotacao.rotZ(-Math.PI*2); setRotacao.mul(setFrente); setFrente.rotX(Math.PI/2.0); setRotacao.mul(setFrente); cameraFrente.setTransform(setRotacao); ViewPlatform vpTopo = new ViewPlatform();//cria-se um viewPlataform cameraTopo.addChild(vpTopo);//adiciona-se o viewplataform ao tg da cena vTop.attachViewPlatform(vpTopo); ViewPlatform vpLeft = new ViewPlatform(); cameraEsquerda.addChild(vpLeft); this.vLeft.attachViewPlatform(vpLeft); ViewPlatform vpPerspectiva = new ViewPlatform();//cria-se um viewPlataform cameraPerspectiva.addChild(vpPerspectiva);//adiciona-se o viewplataform ao tg da cena vPerspective.attachViewPlatform(vpPerspectiva); ViewPlatform vpFront = new ViewPlatform();//cria-se um viewPlataform cameraFrente.addChild(vpFront);//adiciona-se o viewplataform ao tg da cena vFront.attachViewPlatform(vpFront); rootTop = new BranchGroup(); rootTop.addChild(cameraTopo); rootTop.addChild(tGradeTop); rootTop.addChild(light); rootTop.addChild(light2); rootTop.addChild(al); rootTop.setCapability(rootTop.ALLOW_DETACH); rootTop.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); rootTop.setCapability(BranchGroup.ALLOW_CHILDREN_READ); rootLeft = new BranchGroup(); rootLeft.addChild(cameraEsquerda); rootLeft.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); rootLeft.setCapability(BranchGroup.ALLOW_CHILDREN_READ); //rootLeft.addChild(tGradeLeft); //rootLeft.setCapability(rootLeft.ALLOW_DETACH); rootPerspective = new BranchGroup(); rootPerspective.addChild(cameraPerspectiva); rootPerspective.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); rootPerspective.setCapability(BranchGroup.ALLOW_CHILDREN_READ); //tPerspective.addChild(tGradePerspective); //otPerspective.setCapability(rootPerspective.ALLOW_DETACH); rootFront = new BranchGroup(); rootFront.addChild(cameraFrente); rootFront.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); rootFront.setCapability(BranchGroup.ALLOW_CHILDREN_READ); //rootFront.addChild(tGradeFront); //rootFront.setCapability(rootFront.ALLOW_DETACH); locale.addBranchGraph(rootTop); locale.addBranchGraph(rootLeft); locale.addBranchGraph(rootPerspective); locale.addBranchGraph(rootFront); primitivas = new J3dPrimitive(this); texture = new Textures(this); propriedades = new Properties(this); cameras = new Cameras(this); primitivas.show(); code = new Code(this); luzes = new Lights(this); this.show(); } Vladimir A. Vernikovski Programmer ------------------------------------------- JPROOF Technologies Ltd. ----- Original Message ----- From: "Silvano Maneck Malfatti" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 16, 2003 4:48 PM Subject: Re: [JAVA3D] Same problem displaying menu in front of Canvas3D > JPopupMenu.setDefaultLightWeightPopupEnabled(false); > ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); > > > I am using this code at the end of my constructor class > > > > class J3DTOOL extends JFrame implements ActionListener > { > JPanel painel1, painel2, painel3, painel4;//paineis para cada visao de > camera > GridBagLayout grid; > Container c; > JToolBar toolbar,toolbar2; > GridBagConstraints posicao; > MyButton b1,b2,b3,b4,b5,make; > WindowAdapter adapter; > JMenuBar mbar; > JMenu file,edit,window,help; > JMenuItem > exit,open,newer,imports,export,copy,paste,cut,wTop,wLeft,wFront,wPerspective ,ind > ex,topics; > JLabel top,perspective,left,front; > Canvas3D cTop,cFront,cLeft,cPerspective; > VirtualUniverse universe; > Locale locale; > View vFront,vPerspective,vLeft,vTop; > BranchGroup rootTop,rootPerspective,rootLeft,rootFront; > TransformGroup tColorCube,tSphere,tCylinder; > J3dPrimitive primitivas; > Textures texture; > Lights luzes; > Cameras cameras; > Properties propriedades; > Code code; > > J3DTOOL() > { > this.setResizable(false); > > Toolkit toolkit = this.getToolkit(); > Dimension winSize = toolkit.getScreenSize(); > > this.setSize(((winSize.width*70)/100),(winSize.height*95)/100); > this.setTitle("J3D TOOL MAX - ProjetoCena.j3d"); > this.setLocation(((winSize.width*15)/100),0); > > c= this.getContentPane(); > grid = new GridBagLayout(); > c.setLayout(grid); > > posicao = new GridBagConstraints(); > > mbar = new JMenuBar(); > this.setJMenuBar(mbar); > > file = new JMenu("Arquivo"); > file.setMnemonic('A'); > > edit = new JMenu("Editar"); > edit.setMnemonic('E'); > > cut = new JMenuItem("Recortar"); > cut.setMnemonic('R'); > > paste = new JMenuItem("Colar"); > paste.setMnemonic('C'); > > copy = new JMenuItem("Copiar"); > copy.setMnemonic('P'); > > edit.add(copy); > edit.add(cut); > edit.add(paste); > > > exit = new JMenuItem("Salvar"); > exit.setMnemonic('S'); > > open = new JMenuItem("Abrir"); > open.setMnemonic('A'); > > newer = new JMenuItem("Novo"); > newer.setMnemonic('N'); > > imports = new JMenuItem("Importar código Java 3D"); > imports.setMnemonic('I'); > > export = new JMenuItem("Exportar para código Java 3D"); > export.setMnemonic('E'); > > window = new JMenu("Zoom"); > window.setMnemonic('Z'); > > wLeft = new JMenuItem("Visão esquerda"); > wLeft.setMnemonic('E'); > > wTop = new JMenuItem("Visão aérea"); > wTop.setMnemonic('A'); > > wPerspective = new JMenuItem("Visão em perspectiva"); > wPerspective.setMnemonic('P'); > > wFront = new JMenuItem("Visão frontal"); > wFront.setMnemonic('F'); > > help = new JMenu("Ajuda"); > help.setMnemonic('j'); > > index = new JMenuItem("Índice"); > index.setMnemonic('I'); > > topics = new JMenuItem("Tópicos"); > topics.setMnemonic('T'); > > > help.add(index); > help.add(topics); > > window.add(wLeft); > window.add(wTop); > window.add(wFront); > window.add(wPerspective); > > > file.add(newer); > file.add(open); > //file.addSeparator(); > file.add(exit); > > mbar.add(file); > mbar.add(edit); > mbar.add(window); > mbar.add(help); > > > toolbar = new JToolBar(); > toolbar2 = new JToolBar(); > painel1 = new JPanel(); > painel2 = new JPanel(); > painel3 = new JPanel(); > painel4 = new JPanel(); > > top = new JLabel("Visão Aérea"); > perspective = new JLabel("Visão Perspectiva"); > left = new JLabel("Visão Esquerda"); > front = new JLabel("Visão Frontal"); > > > cTop = new Canvas3D(null); > cTop.setBackground(Color.black); > cTop.setSize(((winSize.width*31)/100), > ((winSize.height*33)/100)); > painel1.add(cTop); > > cPerspective = new Canvas3D(null); > cPerspective.setBackground(Color.red); > cPerspective.setSize(((winSize.width*31)/100), > ((winSize.height*33)/100)); > painel2.add(cPerspective); > > cLeft = new Canvas3D(null); > cLeft.setBackground(Color.green); > cLeft.setSize(((winSize.width*31)/100), > ((winSize.height*33)/100)); > painel3.add(cLeft); > > cFront = new Canvas3D(null); > cFront.setBackground(Color.blue); > cFront.setSize(((winSize.width*31)/100), > ((winSize.height*33)/100)); > painel4.add(cFront); > > > b1 = new MyButton("Barra de Propriedades",new ImageIcon > ("Propreties.gif")); > b2 = new MyButton("Geometrias",new ImageIcon("Geometry.gif")); > b3 = new MyButton("Texturas",new ImageIcon("Texture.gif")); > b4 = new MyButton("Luzes",new ImageIcon("Light.gif")); > b5 = new MyButton("Câmeras",new ImageIcon("Camera.gif")); > make = new MyButton("Gerar Código Java3D",new ImageIcon > ("Make.gif")); > > b1.addActionListener(this); > b2.addActionListener(this); > b3.addActionListener(this); > b4.addActionListener(this); > b5.addActionListener(this); > make.addActionListener(this); > > toolbar.add(b2); > toolbar.add(b3); > toolbar.add(b4); > toolbar.add(b5); > > toolbar2.add(new MyButton("Nova Cena",new ImageIcon > ("Code.gif"))); > toolbar2.add(b1); > toolbar2.add(new MyButton("Desfazer",new ImageIcon > ("Undo.gif"))); > toolbar2.add(new MyButton("Refazer",new ImageIcon("Redo.gif"))); > toolbar2.add(make); > > posicao.gridy=0; > posicao.gridx=0; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=0; > posicao.weighty=0; > posicao.fill=GridBagConstraints.BOTH; > grid.setConstraints(toolbar2,posicao); > c.add(toolbar2); > > posicao.gridy=0; > posicao.gridx=1; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=0; > posicao.weighty=0; > posicao.fill=GridBagConstraints.BOTH; > grid.setConstraints(toolbar,posicao); > c.add(toolbar); > > > posicao.gridy=1; > posicao.gridx=0; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=5; > posicao.weighty=0; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(top,posicao); > c.add(top); > > posicao.gridy=1; > posicao.gridx=1; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=5; > posicao.weighty=0; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(front,posicao); > c.add(front); > > > posicao.gridy=2; > posicao.gridx=0; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=5; > posicao.weighty=5; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(painel1,posicao); > c.add(painel1); > > posicao.gridy=2; > posicao.gridx=1; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=5; > posicao.weighty=5; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(painel4,posicao); > c.add(painel4); > > posicao.gridy=4; > posicao.gridx=0; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=5; > posicao.weighty=5; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(painel3,posicao); > c.add(painel3); > > posicao.gridy=4; > posicao.gridx=1; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=5; > posicao.weighty=5; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(painel2,posicao); > c.add(painel2); > > > posicao.gridy=3; > posicao.gridx=0; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=1; > posicao.weighty=1; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(left,posicao); > c.add(left); > > > posicao.gridy=3; > posicao.gridx=1; > posicao.gridwidth=1; > posicao.gridheight=1; > posicao.weightx=1; > posicao.weighty=1; > posicao.fill=GridBagConstraints.NONE; > grid.setConstraints(perspective,posicao); > c.add(perspective); > > > adapter = new MyWindowAdapter(this); > addWindowListener(adapter); > > Shape3D grade1 = this.criaCenario(); > Shape3D grade2 = this.criaCenario2(); > > > universe = new VirtualUniverse(); > locale = new Locale(universe); > > PhysicalBody corpoFrente = new PhysicalBody();//corpo fisico > PhysicalEnvironment ambienteFrente = new PhysicalEnvironment > ();//corpo do ambiente > vFront = new View();//cria-se um view com o canvas3d atachado e > seta-se o corpo fisico e o corpo do ambiente > vFront.addCanvas3D(cFront); > vFront.setPhysicalBody(corpoFrente); > vFront.setPhysicalEnvironment(ambienteFrente); > TransformGroup cameraFrente = new TransformGroup(); > > PhysicalBody corpoTopo = new PhysicalBody();//corpo fisico > PhysicalEnvironment ambienteTopo = new PhysicalEnvironment > ();//corpo do ambiente > vTop= new View();//cria-se um view com o canvas3d atachado e > seta-se o corpo fisico e o corpo do ambiente > vTop.addCanvas3D(cTop); > vTop.setPhysicalBody(corpoTopo); > vTop.setPhysicalEnvironment(ambienteTopo); > TransformGroup cameraTopo = new TransformGroup(); > > PhysicalBody corpoEsquerda = new PhysicalBody();//corpo fisico > PhysicalEnvironment ambienteEsquerda = new PhysicalEnvironment > ();//corpo do ambiente > vLeft= new View();//cria-se um view com o canvas3d atachado e > seta-se o corpo fisico e o corpo do ambiente > vLeft.addCanvas3D(cLeft); > vLeft.setPhysicalBody(corpoEsquerda); > vLeft.setPhysicalEnvironment(ambienteEsquerda); > TransformGroup cameraEsquerda = new TransformGroup(); > > PhysicalBody corpoPerspectiva = new PhysicalBody();//corpo > fisico > PhysicalEnvironment ambientePerspectiva = new > PhysicalEnvironment();//corpo do ambiente > vPerspective= new View();//cria-se um view com o canvas3d > atachado e seta-se o corpo fisico e o corpo do ambiente > vPerspective.addCanvas3D(cPerspective); > vPerspective.setPhysicalEnvironment(ambientePerspectiva); > vPerspective.setPhysicalBody(corpoPerspectiva); > TransformGroup cameraPerspectiva = new TransformGroup(); > > Transform3D setFrente = new Transform3D(); > Transform3D setRotacao = new Transform3D(); > > tColorCube = new TransformGroup(); > tSphere = new TransformGroup(); > tCylinder = new TransformGroup(); > > setFrente.set(new Vector3f(0.0f,0.0f,-0.65f)); > tColorCube.addChild(new ColorCube(0.3)); > tColorCube.setTransform(setFrente);//transformacao do color cube > tColorCube.setCapability(TransformGroup.ALLOW_CHILDREN_READ); > tColorCube.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); > tColorCube.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); > tColorCube.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); > tColorCube.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); > > > setFrente.set(new Vector3f(0.0f,0.0f,-3.0f)); > setRotacao.rotZ(Math.PI); > setRotacao.mul(setFrente); > setFrente.set(new Vector3f(-0.6f,0.0f,-0.8f)); > tCylinder.setTransform(setFrente); > TextureLoader textura = new TextureLoader("stone.jpg",this); > Appearance ap = new Appearance(); > ap.setTexture(textura.getTexture()); > Sphere cylinder = new Sphere(0.2f,Primitive.GENERATE_NORMALS | > Primitive.GENERATE_TEXTURE_COORDS,ap); > cylinder.setAppearance(ap); > tCylinder.addChild(cylinder); > > //setFrente.set(new Vector3f(0.0f,0.0f,-3.0f)); > //setRotacao.rotZ(Math.PI); > //setRotacao.mul(setFrente); > setFrente.set(new Vector3f(0.0f,0.6f,-0.8f)); > tSphere.setTransform(setFrente); > Color3f black = new Color3f(0.0f,0.0f,0.0f); > Color3f white = new Color3f(1.0f,1.0f,1.0f); > Color3f color = new Color3f(0.0f, 0.4f, 0.0f); > ColoringAttributes ca = new ColoringAttributes(); > ca.setColor(color); > Appearance apc = new Appearance(); > apc.setMaterial(new Material(color, color, color, > color, 80.0f)); > Sphere esfera = new Sphere(0.2f,apc); > > apc.setCapability(Appearance.ALLOW_MATERIAL_READ); > apc.setCapability(Appearance.ALLOW_MATERIAL_WRITE); > > tSphere.addChild(esfera); > tSphere.setCapability(TransformGroup.ALLOW_CHILDREN_READ); > tSphere.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); > tSphere.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); > tSphere.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); > tSphere.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); > > BoundingSphere bound = new BoundingSphere(new Point3d > (),1000000.0);//cria um objeto do tipo boundingsphere para setar a area de > atuacao da camera > Color3f lightColor = new Color3f(0.7f, 0.7f, 0.7f);//cria uma > cor > Vector3f lightDirection = new Vector3f(-1.0f, -1.0f, - > 1.0f);//cria uma direcao > DirectionalLight light = new DirectionalLight(lightColor, > lightDirection);//cria uma luz com cor e direcao especificados anteriormente > light.setInfluencingBounds(bound);//seta a area de influencia > da luz > > BoundingSphere bound2 = new BoundingSphere(new Point3d > (),1000000.0);//cria um objeto do tipo boundingsphere para setar a area de > atuacao da camera > Color3f lightColor2 = new Color3f(0.7f, 0.7f, 0.7f);//cria uma > cor > Vector3f lightDirection2 = new Vector3f(0.0f, 0.0f, - > 1.0f);//cria uma direcao > DirectionalLight light2 = new DirectionalLight(lightColor, > lightDirection);//cria uma luz com cor e direcao especificados anteriormente > light2.setInfluencingBounds(bound);//seta a area de influencia > da luz > > AmbientLight al = new AmbientLight(new Color3f(0.7f,0.7f,0.7f)); > > TransformGroup tGradeTop = new TransformGroup(); > tGradeTop.addChild(tColorCube); > tGradeTop.addChild(tSphere); > tGradeTop.addChild(tCylinder); > tGradeTop.addChild(this.criaCenario()); > tGradeTop.addChild(this.criaCenario2()); > tGradeTop.setTransform(setRotacao); > > tGradeTop.setCapability(TransformGroup.ALLOW_CHILDREN_READ); > tGradeTop.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); > tGradeTop.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); > tGradeTop.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); > tGradeTop.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); > > setRotacao = new Transform3D(); > setFrente = new Transform3D(); > setFrente.set(new Vector3f(0.1f,-3.3f,-2.5f)); > setRotacao.rotZ(Math.PI/4.0); > setRotacao.mul(setFrente); > setFrente.rotX(Math.PI/2.7); > setRotacao.mul(setFrente); > cameraPerspectiva.setTransform(setRotacao); > > setRotacao = new Transform3D(); > setFrente = new Transform3D(); > setFrente.set(new Vector3f(0.0f,-2.35f,-3.5f)); > setRotacao.rotZ(-Math.PI/2); > setRotacao.mul(setFrente); > setFrente.rotX(Math.PI/2.0); > setRotacao.mul(setFrente); > cameraEsquerda.setTransform(setRotacao); > > > setRotacao = new Transform3D(); > setFrente = new Transform3D(); > setFrente.set(new Vector3f(0.0f,-2.3f,-3.5f)); > setRotacao.rotZ(-Math.PI*2); > setRotacao.mul(setFrente); > setFrente.rotX(Math.PI/2.0); > setRotacao.mul(setFrente); > cameraFrente.setTransform(setRotacao); > > ViewPlatform vpTopo = new ViewPlatform();//cria-se um > viewPlataform > cameraTopo.addChild(vpTopo);//adiciona-se o viewplataform ao tg > da cena > vTop.attachViewPlatform(vpTopo); > > ViewPlatform vpLeft = new ViewPlatform(); > cameraEsquerda.addChild(vpLeft); > this.vLeft.attachViewPlatform(vpLeft); > > ViewPlatform vpPerspectiva = new ViewPlatform();//cria-se um > viewPlataform > cameraPerspectiva.addChild(vpPerspectiva);//adiciona-se o > viewplataform ao tg da cena > vPerspective.attachViewPlatform(vpPerspectiva); > > ViewPlatform vpFront = new ViewPlatform();//cria-se um > viewPlataform > cameraFrente.addChild(vpFront);//adiciona-se o viewplataform ao > tg da cena > vFront.attachViewPlatform(vpFront); > > rootTop = new BranchGroup(); > rootTop.addChild(cameraTopo); > rootTop.addChild(tGradeTop); > rootTop.addChild(light); > rootTop.addChild(light2); > rootTop.addChild(al); > rootTop.setCapability(rootTop.ALLOW_DETACH); > > rootTop.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); > rootTop.setCapability(BranchGroup.ALLOW_CHILDREN_READ); > > rootLeft = new BranchGroup(); > rootLeft.addChild(cameraEsquerda); > rootLeft.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); > rootLeft.setCapability(BranchGroup.ALLOW_CHILDREN_READ); > > //rootLeft.addChild(tGradeLeft); > //rootLeft.setCapability(rootLeft.ALLOW_DETACH); > > > rootPerspective = new BranchGroup(); > rootPerspective.addChild(cameraPerspectiva); > rootPerspective.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); > rootPerspective.setCapability(BranchGroup.ALLOW_CHILDREN_READ); > //tPerspective.addChild(tGradePerspective); > //otPerspective.setCapability(rootPerspective.ALLOW_DETACH); > > > rootFront = new BranchGroup(); > rootFront.addChild(cameraFrente); > rootFront.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); > rootFront.setCapability(BranchGroup.ALLOW_CHILDREN_READ); > //rootFront.addChild(tGradeFront); > //rootFront.setCapability(rootFront.ALLOW_DETACH); > > > locale.addBranchGraph(rootTop); > locale.addBranchGraph(rootLeft); > locale.addBranchGraph(rootPerspective); > locale.addBranchGraph(rootFront); > > > primitivas = new J3dPrimitive(this); > texture = new Textures(this); > propriedades = new Properties(this); > cameras = new Cameras(this); > primitivas.show(); > code = new Code(this); > > luzes = new Lights(this); > > -------------> JPopupMenu.setDefaultLightWeightPopupEnabled(false); > -------------> ToolTipManager.sharedInstance().setLightWeightPopupEnabl(false); > > this.show(); > } > > > > > > > > > Citando Vladimir Vernikovski <[EMAIL PROTECTED]>: > > > Can I see how you apply this code? > > > > Vladimir A. Vernikovski > > Programmer > > ------------------------------------------- > > JPROOF Technologies Ltd. > > ----- Original Message ----- > > From: "Silvano Maneck Malfatti" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, June 16, 2003 3:54 PM > > Subject: [JAVA3D] Same probleme displaying menu in front of Canvas3D > > > > > > > > > > I have the same problem in my program...but the code > > > > > > JPopupMenu.setDefaultLightWeightPopupEnabled(false); > > > ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); > > > > > > > > > didn´t solve my problem. > > > > > > > > > > > > > > > somebody has some idea > > > > > > > > > Thank you > > > > > > > > > /********************************************* > > > SILVANO MALFATTI > > > COMPUTER SCIENCE - URI University > > > HOME - http://www.urisan.tche.br/~smalfatti > > > ********************************************/ > > > > > > > > > > > > > > > ------------------------------------------------- > > > URI - Campus de Santo Angelo-RS > > > http://www.urisan.tche.br > > > > > > > =========================================================================== > > 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". > > > > > /********************************************* > SILVANO MALFATTI > COMPUTER SCIENCE - URI University > HOME - http://www.urisan.tche.br/~smalfatti > ********************************************/ > > > > > ------------------------------------------------- > URI - Campus de Santo Angelo-RS > http://www.urisan.tche.br > > =========================================================================== > 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".