这是我的 java 类,我得到了NumberFormatException
. 谁能帮我?我已经尝试了很多次,但它一直有这个错误。
public class HelloFromHTML extends JApplet
{
String name;
String age, dimensions1 ,dimensions2;
int num;
Font f;
public void init()
{
f = new Font("TimesRoman", Font.BOLD,30);
String a = this.getParameter("ageHTML");
num = Integer.parseInt(a);
name = "Hello " + getParameter("nameHTML") + " " + num + " years'";
dimensions1 = "JApplet size is " + getParameter("width") + ", " + getParameter("height");
dimensions2 = "size is " + String.valueOf(getWidth()) + ", " + String.valueOf(getHeight());
}
public void paint(Graphics g)
{
super.paint(g);
g.setFont(f);
g.setColor(Color.black);
//////////////////////////////////
// Display String
g.drawString(name,5,50);
g.drawString(dimensions1,5,100);
g.drawString(dimensions2,5,200);
}
}