Shai_Hulud
01-15-2009, 11:32 PM
First post! I'm pretty excited to be getting into a forum that doesn't RickRoll me every 5 seconds. :thumbsup:
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?
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.
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?
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.