【求助~Help!!】Applet getParameter获取html的param参数值为null

[复制链接]
查看11 | 回复0 | 2021-1-27 06:41:27 | 显示全部楼层 |阅读模式


AppletgetParameter获取html的param参数值为null
已将html文件放入class的bin目录与项目文件夹下,但运行java程序时还是提示
java.lang.NumberFormatException:null
atjava.lang.Integer.parseInt(Integer.java:542)
atjava.lang.Integer.parseInt(Integer.java:615)
atxuexi.applettest2.init(applettest2.java:14)
atsun.applet.AppletPanel.run(AppletPanel.java:434)
atjava.lang.Thread.run(Thread.java:745)
-----------------------------------html文件-----------------------------------------------------------------------------------





-----------------------------------------------java代码-----------------------------------------------------------------------
packagexuexi;
importjava.applet.*;
importjava.awt.*;
importorg.omg.CORBA.Request;
publicclassapplettest2extendsAppletimplementsRunnable{
Imagebackgroud;
Stringtext;
booleanloop=true;
intdelay=100;
publicvoidinit(){
backgroud=getImage(getCodeBase(),getParameter("backgroud"));
System.out.println(getCodeBase());
text=getParameter("text");
delay=(int)Integer.parseInt(getParameter("delay"));
}
publicvoidstart(){
Threadt;
t=newThread(this);
t.start();
}
publicvoidstop(){
loop=false;
}
publicvoidrun(){
intx=0;
Graphicsg=getGraphics();
Imagebuffer=createImage(getWidth(),getHeight());
Graphicsgp=buffer.getGraphics();
while(loop){
gp.drawImage(backgroud,0,0,getWidth(),getHeight(),this);
gp.drawString(text,x,50);
g.drawImage(buffer,0,0,this);
x+=2;
if(x>=getWidth()){
x=0;
}
try{
Thread.sleep(delay);
}catch(Exceptione){}
}
}
}

分 -->
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行