In my main file.
public class MainFile extends LwjglApplet
{
scoreManager = new ScoreManager();
}
In my scoreManager
public class ScoreManager extends JApplet
{
JSObject window = JSObject.getWindow(this);
public void SubmitScore(){
Object array[];
array = new Object[2];
array[0] = currentGameMode;
array[1] = GridSize;
window.call("submitScore", array);
}
}
error:
Exception in thread "main" netscape.javascript.JSException
at netscape.javascript.JSObject.getWindow(Unknown Source)
at com.liquidrockgames.wordzen.ScoreManager.<init>(ScoreManager.java:9)
at com.liquidrockgames.wordzen.MainFile.main(WordZenApplet.java:52)
Caused by: java.lang.NullPointerException
at java.applet.Applet.getParameter(Unknown Source)
... 3 more
Anyone can help me please~~
Instead of initializing where you define the variable, try it in JApplet's init method:
...
JSObject window;
public void init() {
window = JSObject.getWindow(this);
}
...
http://java.sun.com/products/plugin/1.3/docs/jsobject.html
After click the submit score, the application in browser become blank
i run my program by browser instead of compiler.
HTML
<script>
function submitScore(gameMode, highScore)
{
}
</script>