Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By JosAH

Thread: java applet error

  1. #1
    The "G" is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default java applet error

    Dear forum,

    hi to all, I'm glad to be here

    I'm studing again the new java, I've studied it years ago, but now I need to learn the changes from the old version.
    I'm using jdk7 and I get this error when I compile
    Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    at First.main(First.java:16)



    Java Code:
    import javax.io.*;
    import javax.awt.*;
    import javax.lang.*;
    import javax.applet.*;
    import javax.net.*;
    import javax.util.*;
    import javax.swing.JApplet;
    import javax.swing.JFrame;
    
    public class First extends JApplet {
    	
    	public void init() {
    		getContentPane().add(new JLabel("Applet!"));	
    	}
    	
    	public static void main(String args[]){
    		System.out.println("Ciao Mondo");
    		JApplet applet = new First();
    		JFrame frame = new JFrame("First");
    		frame.getContentPane().add(applet);
    		frame.setSize(100,50);
    		applet.init();
    		applet.start();
    		frame.setVisible(true);
    	}
    
    }
    all the suggestions are accepted

    Giuseppe

  2. #2
    The "G" is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Re: java applet error

    I've found the mistake!
    I've correct the imports, no it's ok

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    
    public class First extends JApplet {
    	
    	public void init() {
    		getContentPane().add(new JLabel("Applet!"));	
    	}
    	
    	public static void main(String args[]){
    		System.out.println("Ciao Mondo");
    		JApplet applet = new First();
    		JFrame frame = new JFrame("First");
    		frame.getContentPane().add(applet);
    		frame.setSize(600,500);
    		applet.init();
    		applet.start();
    		frame.setVisible(true);
    	}
    
    }

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,993
    Rep Power
    9

    Default Re: java applet error

    This thread is over two years old. Please post your question in your own thread. I'm locking this one.

    Edit: Nevermind, looks like the user deleted his post anyway.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: java applet error

    Quote Originally Posted by KevinWorkman View Post

    Edit: Nevermind, looks like the user deleted his post anyway.
    Nope, I did it; didn't you notice the 'whoosh!' behind your back? That was me, axing the reply from this old thread (while you were reading it ;-)

    kind regards,

    Jos
    KevinWorkman likes this.
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Java applet crashes and produces error code
    By jefferz in forum Java Applets
    Replies: 1
    Last Post: 05-18-2012, 06:40 PM
  2. java applet error
    By jobud9 in forum New To Java
    Replies: 9
    Last Post: 01-21-2012, 08:36 PM
  3. Certification Error on Java Applet
    By netsuvi in forum Java Applets
    Replies: 0
    Last Post: 06-21-2011, 11:16 AM
  4. Java Applet Runtime error
    By sarwar1234 in forum Java Applets
    Replies: 12
    Last Post: 09-21-2010, 03:26 PM
  5. Basic Java applet error, cant figure it out!
    By alacn in forum Java Applets
    Replies: 3
    Last Post: 08-03-2010, 07:25 PM

Posting Permissions

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