text: Results 1 to 3 of 3
  Thread: Beginner help with using APPLET
  - Join Date
  - Jan 2009
  - Location
  - Atlanta, BAYBAY!
  - 3
  - Thanks
  - 1
  - Thanked 0 Times in 0 Posts
  Beginner help with using APPLET
  First post! I'm pretty excited to be getting into a forum that doesn't RickRoll me every 5 seconds.
  I'm taking intro to JAVA, and we are discussing the use of APPLET. He posted this code on our class website, and its not pulling up in my compiler. Is there something wrong with the code itself?
  I apologize if this is a n00bie b00bie post, but you gotta start somewhere right?
  Code:
  import java.applet.*; import javax.swing.JOptionPane; import java.awt.*; public class AppletTest extends Applet { public void init(){ System.out.println("Applet initialization."); } public void start(){ System.out.println("Applet starting."); } /** * public void stop(){ System.out.println("Applet stopping."); } **/ public void paint(Graphics g) { g.drawString("Hello ", 5, 15); String name = JOptionPane.showInputDialog("What is your name?"); g.drawString("Hello " + name + ". Welcome to GGC!", 5, 15); } }
  I understand that essentially is supposed to log what you type in as your name and display simple text output including your name in the text.
  But why the use of an applet? I can't investigate this myself b/c my compiler states:
  "Static Error: No method in AppletTest with name 'main' accepts arguments (String[])"
  when ever i attempt to run the code. Any sort of feedback on this would be so helpful. Thank you.
  Been quite a while since I've even looked at an applet, but my guess is you are trying to simply execute the applet program using the java command, or the function of an editor. Applets cannot be run this way as far as I know. You will need to look into either embedding it into a mockup web page or using the applet viewer.
  A google search for the applet viewer turned up:
  That should get you going in the right direction.
  - Join Date
  - Jan 2009
  - Location
  - india
  - 145
  - Thanks
  - 0
  - Thanked 5 Times in 5 Posts
  Applets don't need main(String args[]) method at all, they can't run as stand alone java program.
  You must embed it into an HTML page or use Applet viewer to execute it.
  Look at
  --------------
  SN Java Servlets