Why does my Java applet not work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrjohn
    New Member
    • May 2009
    • 31

    Why does my Java applet not work?

    I've been experimenting with this Java applet and Firefox, but after I recompile the code and refresh/reopen the page, the changes are not reflected in the browser. Why's that?

    [code="java]
    import java.applet.*;
    import java.awt.*;

    public class Program extends Applet
    {
    public void paint (Graphics g)
    {
    g.drawString("H ello World!", 125, 225);
    //g.drawString("G ood morning America.", 100, 100);
    g.drawString("H amster BBQ.", 50, 50);
    }
    }
    [/code]
    When I comment or uncomment one of the lines (8 thru 10), the changes are not reflected in the browser. Why is this?
    Here is the code in the HTML file I'm using.
    [code="html]
    <html>
    <head>
    <title>Java Test Program</title>
    </head>
    <body>
    <applet code="Program.c lass" height=500 width=500></applet>
    <div>TEST TEXT</div>
    </body>
    </html>
    [/code]
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    My best guess would be that you need to clear your browser cache.

    :)

    -Frinny

    Comment

    • mrjohn
      New Member
      • May 2009
      • 31

      #3
      That doesn't seem to work, I'm afraid. I followed Firefox's instructions on how to clear the cache, but it doesn't seem to make any difference. Thanks anyhow.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by sun tutorial
        problem: I fixed some bugs and re-built my applet's source code. When i reload the applet's web page, my fixes are not showing up.

        * you may be viewing a previously cached version of the applet. Close the browser. Open the java control panel and delete temporary internet files. This will remove your applet from cache. Try viewing your applet again.
        . .

        Comment

        • regan2007
          New Member
          • Oct 2009
          • 12

          #5
          Your applet will obviously will not start because it strictly needs a init() method to run,init method is a method to run java applet..Visit these wonderful website if you want to learn java applet programming : [<links removed>

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by regan2007
            Your applet will obviously will not start because it strictly needs a init() method to run,init method is a method to run java applet..Visit these wonderful website if you want to learn java applet programming :... or ...
            Don't be silly. Read the posts in this thread. The applet is displaying. It's the changes that are not being picked up.

            P.S I've removed your advertising links.

            Comment

            Working...