applet paint() refresh problems
- From: "foo" <nospam@xxxxxxxxxx>
- Date: Fri, 27 May 2005 20:48:15 +0000 (UTC)
the following applet is supposed to draw random lines on the screen, but
doesn't. does anyone know how to make it refresh?
thanks in advance
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
import java.text.*;
import java.lang.*;
public class UI2 extends Applet{
private int x1,y1,x2,y2;
public void init() {
for(;;) {
x1=(int)(Math.random()*100);
y1=(int)(Math.random()*100);
x2=(int)(Math.random()*100);
y2=(int)(Math.random()*100);
repaint();
}
}
public void paint(Graphics g) {
g.setColor(Color.black);
g.drawLine(x1, y1, x2, y2);
}
public void update(Graphics g) {
paint(g);
}
}
.
- Prev by Date: Re: return more than one object within one method
- Next by Date: Re: return more than one object within one method
- Previous by thread: check string for different criteria
- Next by thread: JSP Array Help
- Index(es):
Relevant Pages
|
|