import java.applet.Applet;
import javax.swing.*;public class refrash extends Applet implements Runnable
{ JLabel jLabel1;
Thread thrr;
int i = 0;
public void init()
{
}
public void start()
{
if (thrr == null)
{
thrr = new Thread(this);
thrr.start();
}
}
public void run()
{ while (true)
{
jLabel1 = new JLabel("i+" + i);
add(jLabel1);
validate (); try
{
Thread.sleep(1000);
System.out.println(i);
i++;
}
catch (InterruptedException e)
{
System.out.println(e);
} }
}
}
import javax.swing.*;public class refrash extends Applet implements Runnable
{ JLabel jLabel1;
Thread thrr;
int i = 0;
public void init()
{
}
public void start()
{
if (thrr == null)
{
thrr = new Thread(this);
thrr.start();
}
}
public void run()
{ while (true)
{
jLabel1 = new JLabel("i+" + i);
add(jLabel1);
validate (); try
{
Thread.sleep(1000);
System.out.println(i);
i++;
}
catch (InterruptedException e)
{
System.out.println(e);
} }
}
}
解决方案 »
- JAVA无法卸载!Windows Installer程序包有问题,此安装需要的DLL不能运行
- 取栈顶元素
- 构造对象的问题
- java如何模拟键盘事件得到输入信息,特别是如何得到中文????
- 请问eclipse有什么好的调试器插件能监视一个变量,当这个变量在被改变之前先挂断,然后自动转到修改这个变量的代码处?
- 如何将在servlet中得到的查询结果集在jsp页面上显示
- 散分问题:一个String字符串转成String[]
- java如何编译为jar文件??
- 这段代码是干什么用的呢?
- 请各位大虾帮帮小弟,只一个小忙而已,谢谢!
- sun网站上的教程里的例子怎么输出的结果不是他说的这个样子呢?
- Java 拨号程序
Image offImage;
Graphics offGraphics; public void update(Graphics g)
{
??Dimension d = size(); ??if ((offGraphics == null) || (d.width != offDimension.width)
????????????|| (d.height != offDimension.height))
??{
????offDimension = d;
????offImage = createImage(d.width, d.height);
????offGraphics = offImage.getGraphics();
??} ??offGraphics.setColor(getBackground());
??offGraphics.fillRect(0, 0, d.width, d.height);
??offGraphics.setColor(Color.Black); ??paintFrame(offGraphics); ??g.drawImage(offImage, 0, 0, null);
} public void paint(Graphics g)
{
??if (offImage != null)
??{
????g.drawImage(offImage, 0, 0, null);
??}
} public void paintFrame(Graphics g)
{
??Dimension d = size();
??int h = d.height / 2;
??for (int x = 0; x <d.width; x++)
??{
????int y1 = (int)((1.0 + Math.sin((x - frame) * 0.05)) + h);
????int y2 = (int)((1.0 + Math.sin((x + frame) * 0.05)) + h);
????g.drawLine(x, y1, x, y2);
??}
}