Results 1 to 2 of 2

Thread: Error with Java Applet

  1. #1
    Join Date
    Mar 2011
    Posts
    2,171
    Thanks
    61
    Thanked 121 Times in 117 Posts
    Blog Entries
    4

    Default Error with Java Applet

    Hello All,
    I have this Java code -

    Code:
    import java.applet.*; 
    import java.awt.*; 
    public class HelloWorld extends Applet 
    {
         public void init() 
         { 
    
         } 
    // This method gets called when the applet is terminated 
    // That's when the user goes to another page or exits the browser. 
         public void stop() 
         { 
    
         } 
    // The standard method that you have to use to paint things on screen 
    // This overrides the empty Applet method, you can't called it "display" for example. 
    
         public void paint(Graphics g) 
         { 
     //method to draw text on screen 
     // String first, then x and y coordinate. 
          g.drawString("Hey hey hey",20,20); 
          g.drawString("Hellooow World",20,40); 
    
         } 
    }
    (Which is compiled into HelloWorld.class)

    and this html

    HTML Code:
    <html>
    <head>
    <title>My First Java Applet</title>
    </head>
    <body>
    Here's my first Java Applet:<br /><br />
    <applet code="HelloWorld.class" width="300" height ="300">
    </body>
    </html>
    However, when I load the html page, the java applet just says

    Error. Click for details

    When I click, it freezes the webpage (and the browser).
    Any suggestions on what to do?
    Last edited by keyboard; 09-26-2012 at 05:47 AM.

  2. #2
    Join Date
    Mar 2011
    Posts
    2,171
    Thanks
    61
    Thanked 121 Times in 117 Posts
    Blog Entries
    4

    Default

    I figured it out; I hadn't enabled the java plugin when I reinstalled java...
    Last edited by keyboard; 09-25-2012 at 11:52 PM.

Bookmarks

Posting Permissions

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