Hi,
I am new to java programming.

I have been creating a simple applet. Which is as follows:

public class HelloWorld extends JApplet
{
    public void paint(Graphics g)
    {
	g.drawRect(0, 0,getSize().width - 1,getSize().height - 1);
        g.drawString("Hello world!", 5, 15);
    }
}

This code is saved in a file named HelloWorld.Java
I embedded this applet in html as follows:

<applet width=300 height=300 codebase="../../build/classes/applettest/HelloWorld.class"> </applet>

But it doesn't display. Just the java image gets displays ("some sort of progress status type") you know
How can i display this applet.
Please help

I suppose your HTML code is incorrect
It should be

<applet width=300 height=300 code="../../build/classes/applettest/HelloWorld.class"> </applet>

if i do this i get the error message as FileNotFoundException. My class file is in different location than the html file so i used codebase instead of code.

when i debug the HelloWorld.java i can output is fine but when i view this in browser it doesn't display.

wat was the problem
I'd like to know

The problem was in HTML file while embedding the applet. In the applet tag i had to use both the combination of code and codebase attribute and set it to proper value. I still exactly don't know what is the problem and what is its proper use. But through series of Hit and Trial i just made it worked. The code in the HTML file is as follows:

<applet codebase="../../build/classes" code="applettest/HelloWorld.class" width=350 height=200></applet>

Thanks

This question has already been answered. Start a new discussion instead.