błąd java.lang.reflect.invocationtargetexception w aplecie [zamknięty]

Moja aplikacja działa bez błędów jako aplikacja, ale jako aplet generuje następujący błąd:

wyjątek java.lang.reflect.invocationtargetexception

To jest moja pierwsza próba użycia mojej aplikacji jako apletu, więc mogłem zrobić coś złego, ale tutaj jest moja główna klasa:

 package main;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JApplet;
import javax.swing.JFrame;

public class MainGame extends JApplet {
    private static final long serialVersionUID = 1L;
    public static final String NAME = "Physics - Projectile Motion Example";
    public static final int HEIGHT = 160;
    public static final int WIDTH = HEIGHT * 16 / 9;
    public static final int SCALE = 4;

    private long reportedFramerate;
    long framerate = 1000 / 60;
    // time the frame began
    long frameStart;
    // number of frames counted this second
    long frameCount = 0;
    // time elapsed during one frame
    long elapsedTime;
    // accumulates elapsed time over multiple frames
    long totalElapsedTime = 0;
    // the actual calculated framerate reported


    public MainGame() {
        run();
    }

    public void run() {
        JFrame frame = new JFrame(MainGame.NAME);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());


        OptionsPanel options = new OptionsPanel();
        GamePanel game = new GamePanel(options);

        frame.setSize(new Dimension ( WIDTH * SCALE, HEIGHT * SCALE ));

        frame.add(game, BorderLayout.CENTER);
        frame.add(options, BorderLayout.SOUTH);
        frame.setLocationRelativeTo(null);
        frame.setResizable(false);
        frame.setVisible(true);
        while(true) {
            frameStart = System.currentTimeMillis();

            if(options.isStartGame() == true) {
                game.run();
            }
            else {
                game.reset();
            }

            // calculate the time it took to render the frame
            elapsedTime = System.currentTimeMillis() - frameStart;
            // sync the framerate
            try {
                // make sure framerate milliseconds have passed this frame
                if (elapsedTime < framerate) {
                    Thread.sleep(framerate - elapsedTime);
                } else {
                    // don't starve the garbage collector
                    Thread.sleep(5);
                }
            } catch (InterruptedException e) {
                break;
            }
            ++frameCount;
            totalElapsedTime += (System.currentTimeMillis() - frameStart);
            if (totalElapsedTime > 1000) {
                reportedFramerate = (long) ((double) frameCount
                        / (double) totalElapsedTime * 1000.0);
                // show the framerate in the applet status window
                //System.out.println("fps: " + reportedFramerate);
                // repaint();
                frameCount = 0;
                totalElapsedTime = 0;

                //System.out.println(reportedFramerate);
            }
        }
    }

    public void init() {
        new MainGame();
    }
    public void start() {
        System.out.println("started");
    }
    public void stop() {
        System.out.println("Stopped");
    }
    public void destroy() {

    }


    public static void main(String[] args) {
        new MainGame();
    }

}

HTML dla obiektu:

<p>
<object type="application/x-java-applet"
    name="physics" width="360" height="320">
    <param name="code" value="main.MainGame.class" />
    <param name="archive" value="physics.jar" />
    <param name="scriptable" value="true" />
    <param name="mayscript" value="true" />
    <param name="file" value="/report_files/1-1272041330710YAIwK" />
</object>
</p>

Przykładowa strona, aby zobaczyć sam błąd:http://fogest.com/java_example/

questionAnswers(1)

yourAnswerToTheQuestion