I’m working on a small Java program which works as an applet.
The program is working fine, but I want to give some parameters in the HTML file which should be used by the applet.
Unfortunaly, the parameters don’t get into the applet and the default values are used.
HTML code:
[code]
<html><head><title></title></head>
<body>
<applet code=”Myapplet.class” width=”400″ height=”400″>
<PARAM name=”Xcoordinaat” value=”1″ />
<PARAM name=”Ycoordinaat” value=”1″ />
</applet>
</body>
</html>
Corresponding part of the Java program:
[code]
double MY = 0;
double MX = 0;
public void init() {
if (this.getParameter(“Xcoordinaat”)!= “” ){
MX = Double.parseDouble(this.getParameter(“Xcoordinaat”));
}
if (this.getParameter(“Ycoordinaat”) != “”) {
MY = Double.parseDouble(this.getParameter(“Ycoordinaat”));
}
MX and MY are global variables (they need to be), and need to be 0 when there’s is no parameter. I think the if statement is ok, because when I leave it out and I don’t initialize MX and MY with 0, it’s still not working.
What am I doing wrong here?
René