24小时热门版块排行榜    

查看: 340  |  回复: 0

m57091003

木虫 (著名写手)

[求助] Java applet的运行结果

public class Example8_2 extends Applet
{  
        int initcount=0;
        int startcount=0;
        int stopcount=0;
        int destroycount=0;
        int paintcount=0;       
   public void init()
   {  
           initcount++;
   }
   public void start()
   {  
           startcount++;
   }
   public void stop()
   {
           stopcount++;
   }
   public void destroy()
   {
           destroycount++;
   }
   public void paint(Graphics g)
   {  
           paintcount++;
      g.drawString("initcount="+initcount,20,60);
      g.drawString("startcount="+startcount,20,80);
      g.drawString("stopcount="+stopcount,20,100);
      g.drawString("destroycount="+destroycount,20,120);
      g.drawString("paintcount="+paintcount,20,140);
   }
}
运行结果分别是1,1,0,0,2;  
问题是:paintcount每次自增1,为什么出来是2.而且每次窗口移动增量都是2.
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

找到一些相关的精华帖子,希望有用哦~

科研从小木虫开始,人人为我,我为人人
相关版块跳转 我要订阅楼主 m57091003 的主题更新
信息提示
请填处理意见