Un texte 2D

</COMMENT> alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason." Your browser is completely ignoring the &lt;APPLET&gt; tag!

RETOUR

SimpleText2D.java

/* Auteur: Nicolas JANEY         */
/* nicolas.janey@univ-fcomte.fr  */
/* Novembre 2001                 */

import java.applet.Applet;
import java.awt.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;

public class SimpleText2D extends Applet {

  public BranchGroup createSceneGraph(SimpleUniverse u) {
    BranchGroup objRoot = new BranchGroup();
    TransformGroup objTrans = new TransformGroup();
    objRoot.addChild(objTrans);
    Transform3D t3D = new Transform3D();
    t3D.setTranslation(new Vector3d(-0.7,-0.2,0.0)) ;
    objTrans.setTransform(t3D);
    Shape3D text;
    text = new Text2D("IUP Info",
                      new Color3f(1.0f,1.0f,0.0f),
                      "Serif",
                      100,
                      Font.BOLD);
    objTrans.addChild(text);
    objRoot.compile();
    return objRoot;
    }

  public SimpleText2D() {
    setLayout(new BorderLayout());
    GraphicsConfiguration config;
    config = SimpleUniverse.getPreferredConfiguration();
    Canvas3D c = new Canvas3D(config);
    add("Center",c);
    SimpleUniverse u = new SimpleUniverse(c);
    BranchGroup scene = createSceneGraph(u);
    u.getViewingPlatform().setNominalViewingTransform();
    u.addBranchGraph(scene);
    }

  public static void main(String[] args) {
    new MainFrame(new SimpleText2D(),300,100);
    }
  }

RETOUR

Remarques,erreurs
nicolas.janey@univ-fcomte.fr