Results 1 to 4 of 4
  1. #1
    shodai is offline Senior Member
    Join Date
    Apr 2012
    Posts
    112
    Rep Power
    0

    Default Applet Not Working???

    I have been trying and trying to get an applet to work. I have this example that should work, but when I open the html file all that shows is the html text. If anyone has any ideas it would be really greatly appreciated.

    Java Code:
    import java.awt.*;
    import java.applet.Applet;
    
    public class MyFirstApplet extends Applet {
    public void paint (Graphics g) {
    g.drawString("This is my first Applet!!!", 100, 25);
    }
    }
    XML Code:
    <HTML>
    <HEAD>
    <TITLE>My First Applet</TITLE>
    <BODY>
    <CENTER>
    <APPLET CODE = 'MyFirstApplet.class' WIDTH = "100" HEIGHT = "25"> 
    </APPLET>
    </CENTER>
    </BODY>
    </HTML>

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Applet Not Working???

    How is the html file loaded into the browser?
    Loaded from a file on a local disk
    loaded via a url from a server

    Check that the html is correctly coded.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    shodai is offline Senior Member
    Join Date
    Apr 2012
    Posts
    112
    Rep Power
    0

    Default Re: Applet Not Working???

    As far as I can know, the HTML is correct. (Sorry it did not post correctly, I will post again). I have tried just clicking on it from the computer and I have tried opening the browser and selecting the file from there. I both cases, only the code shows up.


    <HTML>
    <HEAD>
    <TITLE>My First Applet</TITLE>
    <BODY>
    <CENTER>
    <APPLET CODE = 'MyFirstApplet.class' WIDTH = "100" HEIGHT = "25">
    </APPLET>
    </CENTER>
    </BODY>
    </HTML>

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Applet Not Working???

    The posted html works normally on my PC in Chrome Win7.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. applet working in applet viewer, not browser
    By plasticfood in forum Java Applets
    Replies: 4
    Last Post: 06-24-2011, 06:47 PM
  2. My Applet Not working
    By mftbrothers in forum Java Applets
    Replies: 3
    Last Post: 03-31-2011, 09:03 AM
  3. Applet Not Working Please Help....
    By ajjukumar in forum New To Java
    Replies: 2
    Last Post: 01-07-2011, 02:16 PM
  4. Applet not working
    By jyothi.priyanka in forum New To Java
    Replies: 5
    Last Post: 04-16-2009, 08:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •