import java.awt.*; import java.applet.*; public class HelloWorld7 extends Applet { private int Width; private int Height; private String s; private Font f = new Font("Helvetica", Font.BOLD, 20); private FontMetrics fm; public void init(){ String param; param = getParameter("strings"); s = (param != null) ? param : new String("Hey! this is a test of ......."); setBackground(new Color(255, 255, 255)); setForeground(new Color(255, 0, 0)); Width = size().width; Height = size().height; resize(Width, Height); } public void paint(Graphics g){ int yo; int x,y; double tmp; g.setFont(f); FontMetrics fm = g.getFontMetrics(); x = (Width - fm.stringWidth(s))/2; // yo = (Height - fm.getHeight())/2; yo = Height / 2; for (int i = 0; i < s.length(); i++) { tmp = Math.sin( (double)i / (double)s.length() * Math.PI * 2.0); y = yo + (int)(tmp * yo * 0.5); g.drawChars(s.toCharArray(), i, 1, x, y); x += fm.charWidth(s.toCharArray()[i]); } } }