applet如何改变左上角的坐标,使曲线实时显示 问题是这样的 ,我想做个实时显示的曲线,用applet,为了试验我编了个程序,是跟timer一块用的,问题出现了以下两个1 每次将这个IE窗口最小化之后,绘制的曲线就少了一块2 等到曲线绘制到applet在html文件里规定的大小的时候就无法继续显示了,请大家帮忙解决下这个问题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己先把程序穿上来import java.awt.*;import java.applet.*;import java.util.*;import java.awt.Graphics;import java.awt.event.*;import javax.swing.Timer;public class graphictest extends Applet { static Random rand=new Random(); public static int[] nrand=new int[2]; static int i=1; private Timer clock = new Timer(100, new ActionListener() { public void actionPerformed(ActionEvent e) { synchronized(graphictest.this) { repaint(); //update(); } } } ); public void init() { //setBackground(Color.green); nrand[0]=0; } public void paint(Graphics g) { super.paint(g); // nrand[1]=rand.nextInt(); g.drawLine(i-1,10,i,10); i=i+1; //nrand[0]=nrand[1]; } public graphictest() { clock.start(); } public void update(Graphics g) { paint(g); }}html文件<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><html><APPLET height=300 width=500 code=graphictest.class> </APPLET></html> 求web 数学公式 编辑器-开源或者免费的! SqlServer2000中的DateTime类型如何转换为Java中的Date类型 在线等候!!! getAttribute的简单问题 求助!!!!!!!!!!!jsp+Tomcat+sql server 2000在线考试系统的实现 网页速度慢如何查找原因? 一个简单问题求教 求救!高手请帮忙.tomcat+jdbc连sqlserver出错 在Tomcat上出现了难以解释的中文乱码... 关于分页显示的问题,非常急 各位高手,请教如何在web页面上画曲线图!在这先谢了!! MyEclipse自带的Tomcat启动是的异常! java 与.net
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.awt.Graphics;
import java.awt.event.*;
import javax.swing.Timer;
public class graphictest extends Applet
{
static Random rand=new Random();
public static int[] nrand=new int[2];
static int i=1;
private Timer clock = new Timer(100,
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
synchronized(graphictest.this)
{
repaint();
//update();
}
}
}
);
public void init()
{
//setBackground(Color.green);
nrand[0]=0;
}
public void paint(Graphics g)
{
super.paint(g);
// nrand[1]=rand.nextInt();
g.drawLine(i-1,10,i,10);
i=i+1;
//nrand[0]=nrand[1];
}
public graphictest()
{
clock.start();
}
public void update(Graphics g)
{
paint(g);
}
}
html文件
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<html>
<APPLET height=300 width=500 code=graphictest.class> </APPLET>
</html>