import java.awt.*; public class jumpinText extends java.applet.Applet implements Runnable { String s = null; char separated[]; int fieldwidth = 1200; int textwidth = 0; int charwidth = 22; int jumpwidth = 120; Thread th = null; int loop; public void init(){ String tmps = null; s = getParameter("text"); if (s == null) { s = "TEST CHAR"; } textwidth = s.length()*charwidth; separated = new char [s.length()]; s.getChars(0,s.length(),separated,0); //resize(fieldwidth,jumpwidth/5 + charwidth); setFont(new Font("TimesRoman",Font.BOLD,charwidth)); setBackground(new Color(255,255,192)); setForeground(Color.red); } public void start(){ if(th == null) { th = new Thread(this); th.start(); } } public void stop(){ th = null; } public void run() { while (th != null) { try { Thread.sleep(100); }catch (InterruptedException e){ ; } repaint(); } th = null; } public void paint(Graphics g){ int cpoint; int x; int y; int i; int tmp; g.setColor(Color.red); if (loop <= 0){ loop = textwidth + fieldwidth; } loop-=10; for (i = 0 ; i < s.length() ; i++){ cpoint = loop + (i*charwidth) - textwidth; if ( cpoint < fieldwidth && cpoint > 0){ tmp = ((cpoint%jumpwidth*2)-jumpwidth); y = tmp * tmp / jumpwidth / 5 + charwidth; x = cpoint; g.drawChars(separated, i,1,x,y); } } } // public boolean mouseDown(java.awt.Event e,int x,int y){ // } // public boolean mouseUp(java.awt.Event e,int x,int y){ // } // public boolean mouseDrag(java.awt.Event e,int x,int y){ // } // public boolean mouseMove(java.awt.Event e,int x,int y){ // } public void mouseEnter(java.awt.Event e){ } public void mouseExit(java.awt.Event e){ } public void gotFocus(){ } public void listFocus(){ } // public boolean keyDown(java.awt.Event e,int x){ // } public void destroy(){ } }