import java.applet.Applet; import java.awt.*; import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.media.j3d.*; public class Valgus2 extends Applet { public Valgus2() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); add(c, BorderLayout.CENTER); BranchGroup juur = new BranchGroup(); Appearance a=new Appearance(); a.setMaterial(new Material()); juur.addChild(new Sphere(0.5f, Sphere.GENERATE_NORMALS, a)); DirectionalLight suundvalgus=new DirectionalLight(); suundvalgus.setInfluencingBounds(new BoundingSphere()); juur.addChild(suundvalgus); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Suundvalgus"); f.add(new Valgus2()); f.setSize(300, 300); f.setVisible(true); } }