
import java.awt.*;
import java.awt.font.*;

public class TestG2D extends Frame
{

  GlyphVector gv;
  Shape shape;
  float theta = 0;
  TestG2D()
  {
    setFont(new Font("Dialog", 0, 12));
    gv = getFont().createGlyphVector(new FontRenderContext(null, false, false),
                                     "Hello World");
    shape = gv.getOutline();
  }
  public void paint(Graphics g) 
  {
    Graphics2D g2d = (Graphics2D) g;
    g2d.translate(120, 250);
    g2d.rotate(theta);
    g.setColor(Color.WHITE);
    g2d.fill(shape);
    //g.drawString("o", 20, 50);
  }

  public static void main(String[] args) {
    TestG2D f = new TestG2D();
    f.setSize(300, 300);
    f.setVisible(true);

    long start = System.currentTimeMillis();
    while (true)
      {
        Graphics g = f.getGraphics();
        f.paint(g);
        f.theta += 0.2F;
        g.dispose();
        if (f.theta % 50F <= 0.2F)
          {
            System.err.println("elapsed time: " + (System.currentTimeMillis() - start));
            start = System.currentTimeMillis();
          }
      }
  }
}
