import java.applet.Applet; import java.awt.*; import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.media.j3d.*; import javax.vecmath.*; public class Rohekoonus extends Applet { public Rohekoonus() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); add(c, BorderLayout.CENTER); BranchGroup juur = new BranchGroup(); Cone k1=new Cone(); Appearance valimus=new Appearance(); Material materjal=new Material( new Color3f(Color.black), //hajuvalgus new Color3f(Color.green), //eralduv new Color3f(Color.green), //peegelduv valgus new Color3f(Color.black), 1 //läige ); valimus.setMaterial(materjal); k1.setAppearance(valimus); juur.addChild(k1); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Roheline koonus"); f.add(new Rohekoonus()); f.setSize(300, 300); f.setVisible(true); } }