Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Java Applet Trouble, Please Help Me Fix?

I created a java class called "Map2D.java" and it has a simple coding to create a rough map of florida by using the "public void paint(Graphics screen)" method. I also created a small html document to run the applet, and so I could see it working. However, when i ran the applet in Internet Explorer, it said in little print on the bottom "Applet Map2D not inited" followed by "Loading Java Applet Failed..." The applet doesn't even show, it just is a big box, with a red 'x' in the top left corner. Does anyone know how to fix this problem, or what i'm doing wrong? Thank you for your help.

1 Answer

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    init means initialize which is the method you must call to create the applet.

    instead of using main just use init():

    imports blah blah blah

    public class Whatever extends JApplet

    {

    public void init() // first method called by applet container

    {

    // initialize stuff here

    }

    public void paint(Graphics g) // called after init() by applet container

    {

    super.paint(g); // call superclass of paint()

    // paint stuff here. example:

    g.drawRect(15, 10, 270, 20);

    }

    } // end class Whatever

    then embed it in your HTML:

    <applet code = "Whatever.class" width = "300" height = "65"></applet>

    There you go. Easy Parcheesi

Still have questions? Get your answers by asking now.