import java.awt.*; import java.applet.Applet; public class Fonfon extends Applet implements Runnable{ Thread th; int o, x, w, h; Image img; MySin posi, red, green, blue; public void init(){ w = size().width; h = size().height; img = createImage(w, h); posi = new MySin(0, w-h, 50); red = new MySin(0, 255, 200); green = new MySin(0, 255, 300); blue = new MySin(0, 255, 350); th = new Thread(this); th.start(); } public void run(){ while(th.isAlive()){ try{ th.sleep(100); }catch(InterruptedException e){} work(); } } void work(){ o = x; x = posi.get(); repaint(); } public void update(Graphics g){ g.drawImage(img, 0, 0, null); } public void repaint(){ Graphics g = img.getGraphics(); g.clearRect(o, 0, h, h); g.setColor(new Color(red.get(), green.get(), blue.get())); g.fillOval(x, 0, h, h); super.repaint(); } } // EOF