Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java applet wont load

807598Jun 15 2006 — edited Jun 16 2006
hi,

for some reason I cant get a test applet I made to load in a webpage. The applet just displays a rectangle and works fine in netbeans but is just an X in a box when I try to load it in a webpage and I get the message : Loading Java applet failed.

The code is:
import java.awt.*;  
import javax.swing.*;
import java.applet.*;

/**
 *
 * @author Nick
 */
public class TestJApplet extends Applet {
    
    /** Creates a new instance of TestApplet */
    public TestApplet() {
    }
    
    public void init()
    {
        
    }
    
    public void paint(Graphics g)
    {
        g.drawRect(30,30,30,30);
    }    
}
and I use

<applet code="TestApplet.class" width="100" height="100"> </applet>

within the HTML code to load the applet.

The TestApplet.class is in the same folder as the index.html file that calls it.

What could be the reason for this?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2006
Added on Jun 15 2006
3 comments
147 views