| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 430 人关注过本帖
标题:[求助] 各位帮下忙啦!!
只看楼主 加入收藏
huainie
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-8-7
收藏
 问题点数:0 回复次数:1 
[求助] 各位帮下忙啦!!

我写了一个用线程写了一个小程序,但启动时老说未初始化小程序,不知是何因,?
import java.awt.*;
import java.net.*;

import javax.swing.*;


public class appt extends JApplet implements Runnable {
Thread t=null;
int y=300;
ImageIcon ima[]=new ImageIcon[3];
URL u=null;
int i=0;

public appt(){
super();
for(i=0;i<3;i++){
u=this.getClass().getResource("香/"+i+".jpg");
ima[i]=new ImageIcon(u);
}
}
public void init(){
t = new Thread(this);
t.start();
}

public void start(){

}
public void paint(Graphics g){
g.setColor(Color.BLACK);
g.fillRect(0, 0, this.getWidth(),this.getHeight());
g.setColor(Color.red);
g.fillOval(50,y,100,100);
y=(y>0?y-15:300);
g.drawImage(ima[i].getImage(),0,0,this);
i=(i<2?i+1:0);

}
public void stop(){

}













public void run() {

while(true){
try {
Thread.sleep(400);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}repaint();
}

}

}

搜索更多相关主题的帖子: public import null 
2006-08-12 18:51
ada518618
Rank: 1
等 级:新手上路
帖 子:184
专家分:0
注 册:2006-3-27
收藏
得分:0 

好象是这里的问题:
public appt(){
super();
for(i=0;i<3;i++){
u=this.getClass().getResource("香/"+i+".jpg");
ima[i]=new ImageIcon(u);
}
}


Eclipse!尽管我现在不懂祢,可是我却对你情有独钟……
2006-08-13 13:13
快速回复:[求助] 各位帮下忙啦!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023054 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved