import java.applet.*; import java.awt.*; /* Moving Radar Beam without Double Buffering (this will cause a flicker to appear) */ public class RadarBeam extends Applet implements Runnable { // notice the "implements runnable", this is needed for using threads Thread t; // create a field that will be used for an instance of a thread private int startAngle; public void init() { setBackground(Color.black); t=new Thread(this); // instantiate a new thread object t.start(); // start our thread running startAngle=90; // start at the top of the screen } public void run() { while(true) { repaint(); try{ t.sleep(5); }catch(InterruptedException e){ ; } startAngle++; } } public void paint(Graphics g) { g.setColor(Color.red); g.fillArc(0,0, size().width, size().height, startAngle, 30); // fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) } }