| I just started learning Java, and I'm having problems...any idea why this is not getting the parameter value from the HTML below?
Java code:
import java.awt.*;
public class RootApplet extends javax.swing.JApplet {
int number;
public void ini() {
String parameter = getParameter("NUMBER");
if (parameter != null)
number = Integer.parseInt(parameter);
}
public void paint(Graphics screen) {
super.paint(screen);
Graphics2D screen2D = (Graphics2D) screen;
screen2D.drawString("The square root of " +
number +
" is " +
Math.sqrt(number), 5, 50);
}
}
HTML code:
<applet code="RootApplet.class" height=100 width=300>
<param name="NUMBER" value=198>
</applet>
thanks! |