import java.applet.Applet; import java.awt.*; import com.sun.j3d.utils.geometry.Text2D; import com.sun.j3d.utils.universe.SimpleUniverse; import javax.media.j3d.*; import javax.vecmath.*; public class Kiri2 extends Applet { public Kiri2() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); add(c, BorderLayout.CENTER); BranchGroup juur = new BranchGroup(); TransformGroup keere1=new TransformGroup(); keere1.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); RotationInterpolator keeraja1= new RotationInterpolator(new Alpha(-1, 10000), keere1); keeraja1.setSchedulingBounds(new BoundingSphere()); juur.addChild(keere1); keere1.addChild(keeraja1); Text2D tekst=new Text2D("Tervitus", new Color3f(Color.green), "Times", 55, Font.ITALIC); PolygonAttributes pind=new PolygonAttributes(); pind.setCullFace(PolygonAttributes.CULL_NONE); //et ka teine pool näha oleks tekst.getAppearance().setPolygonAttributes(pind); keere1.addChild(tekst); juur.compile(); SimpleUniverse u = new SimpleUniverse(c); u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(juur); } public static void main(String[] args) { Frame f=new Frame("Pöörlev kiri"); f.add(new Kiri2()); f.setSize(300, 300); f.setVisible(true); } }