Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 大侠们,帮我看看哪错了呀
ice0819





发贴: 17
积分: 1
于 2009-04-02 20:10 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
import java.awt.*;

class ToolkitTest extends Frame
{
Image [] images=new Image[4];
String [] names={"1.jpg","2.jpg","3.jpg","4.jpg"};

ToolkitTest()
{

while(true)
{
for(int i=0;i<names.length;i++)
images[i]= this.getToolkit().getImage(names[i]);
repaint();
}
setSize(500,450);
setVisible(true);

}

public void update(Graphics g){paint(g);}

public void paint(Graphics g)
{

int x=(int)Math.random()*480;
int y=(int)Math.random()*420;
g.drawImage(images[(int)Math.random()*4],x,y,null);
}

public static void main(String args[]){new ToolkitTest();}
}


阿熊 edited on 2009-04-07 20:17

作者 Re:大侠们,帮我看看哪错了呀 [Re:ice0819]
ice0819





发贴: 17
积分: 1
于 2009-04-02 20:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
图片处是 paint(g)


作者 Re:大侠们,帮我看看哪错了呀 [Re:ice0819]
yanglijuanylj





发贴: 5
积分: 0
于 2009-04-07 17:36 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
要是你的还是不能运行的话,你就把 setSize(500,450);setVisible(true); 这两句放在 while(ture) 前面.


作者 Re:大侠们,帮我看看哪错了呀 [Re:ice0819]
yanglijuanylj





发贴: 5
积分: 0
于 2009-04-07 17:37 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
要是你的还是不能运行的话,你就把 setSize(500,450);setVisible(true); 这两句放在 while(ture) 前面. 可能会根据你的运行工具的差异而要改下的.



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2018 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号
客服电话 0592-8750026    客服信箱 714923@qq.com    客服QQ 714923