Results 1 to 6 of 6
  1. #1
    fantasyme is offline Member
    Join Date
    Apr 2010
    Posts
    16
    Rep Power
    0

    Default Cannot complie JApplet in Eclipe

    I try to complie JApplet in Eclipe but it doesn't work.
    No error but nothing shows in the program.
    The program works fine with run as application but not as applet.
    Java Code:
    package dicegame;
    
    
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    
    
    public class game extends JApplet {
    
    
    	public static void main(String[] args) {
    		JFrame window = new JFrame("game");
    		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		
           window.setContentPane(new roll());
    
            window.setSize(240, 300);
      
           window.setLocationRelativeTo(null);
            window.setVisible(true);
            
            
            
    	}
    	
    	
    	
    }

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Simple, this is not an applet.

    What the roll() do, where you define it? I cannot see the definition of it in your code.

  3. #3
    fantasyme is offline Member
    Join Date
    Apr 2010
    Posts
    16
    Rep Power
    0

    Default

    roll() is from my JPanel class.

    How can I made this into JApplet?
    I must use with MySql for assignment.

    I am new to Java, sorry if I make you feel ignore.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    So what you want to do in the Applet? Better to explain more clearly. And also please keep in mind that no one wants to do your assignment. You must put some effort. :)

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by fantasyme View Post
    roll() is from my JPanel class.

    How can I made this into JApplet?
    I must use with MySql for assignment.

    I am new to Java, sorry if I make you feel ignore.
    You must read the tutorials on how to create a JApplet. As Eranga states, you don't use a main method. Instead you will need an init method, but the tutorials will tell you much better than I can. Google for them.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. JApplet on MAC
    By ld_pvl in forum Java Applets
    Replies: 0
    Last Post: 08-23-2009, 01:40 PM
  2. How to set permissions for a JApplet
    By Gatts79 in forum Java Applets
    Replies: 2
    Last Post: 08-12-2009, 01:54 PM
  3. Replies: 3
    Last Post: 03-03-2009, 09:48 PM
  4. JFrame to JApplet or JApplet to JApplet
    By ramesh.8189 in forum AWT / Swing
    Replies: 13
    Last Post: 02-08-2009, 06:14 AM
  5. JApplet Problem
    By tanmoy.b81 in forum AWT / Swing
    Replies: 2
    Last Post: 07-28-2008, 06:56 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
  •