im new to java so any help will be much appreciated. im trying to create an applet which generates positive integers (1,2,3....) and displays each one, together with a message, at 2 second intervals. i need to use clipping to minimise flicker. below is what i have done so:
the output needs to be like: THE NUMBER IS : 3
import java.awt.*;
public class NumberGenerator extends TaskingApplet { Font theFont; FontMetrics fm; int stringwidth, stringheight, count;
public void init() { theFont = new Font ("Courier", Font.BOLD, 24); setForeground(Color.blue); fm = getFontMetrics (theFont); String str="12345"; count = count + 1; stringheight = fm.getHeight(); stringwidth = fm.stringWidth(str); }
public void run() { while (true) { count = new count(); repaint(); try {Thread.sleep (1000);} catch (InterruptedException e) { } } }