Why can't I get my applet (on a Canvas) to work?

154 Views Asked by At

While making a game and putting it on a Canvas object, I use the following applet code:

package me.NoahCagle.game;

import java.applet.Applet;
import java.awt.BorderLayout;

public class GameApplet extends Applet {
private static final long serialVersionUID = 1L;

private Game game = new Game();

public void init() {
    setLayout(new BorderLayout());
    add(game, BorderLayout.CENTER);
}

public void start() {
    game.start();
}

public void stop() {
    game.stop();
}

}

HTML:

<applet archive="game.jar" code="me.NoahCagle.game.GameApplet" width="640" height="480"></applet>`

Then after I have this, I run it using Chrome, but this doesn't work. It throws me an InvocationTargetException

And the applet runs correctly in Eclipse.

0

There are 0 best solutions below