import java.applet.Applet; import java.awt.*; import com.sun.j3d.utils.universe.SimpleUniverse; import com.sun.j3d.utils.geometry.Text2D; import javax.media.j3d.*; import javax.vecmath.*; public class Kiri3 extends Applet { public Kiri3() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); add(c, BorderLayout.CENTER); BranchGroup juur = new BranchGroup(); Text3D t=new Text3D( new Font3D(new Font("Helvetica", Font.PLAIN, 1), new FontExtrusion()), "Tere" , new Point3f(-1, 0.6f, -1.5f) ); Material m=new Material(); m.setLightingEnable(true); Appearance a=new Appearance(); a.setMaterial(m); Shape3D s=new Shape3D(); s.setGeometry(t); s.setAppearance(a); juur.addChild(s); Color3f valgusvarv=new Color3f(Color.white); AmbientLight al=new AmbientLight(valgusvarv); al.setInfluencingBounds(new BoundingSphere()); juur.addChild(al); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Kolmemõõtmeline kiri"); f.add(new Kiri3()); f.setSize(300, 300); f.setVisible(true); } }