newbie java programming applet issue
i am a student taking an intro to OOP course using java- the course only offers support for windows. i have textMate and blue J as java editing environments. i have successfully managed a few lessons but now i am having trouble with applets. my applet source code will run in blue j but not in textmate and i think the reason has to do with the applet extension. first when i run the program successfully in blue jay it utilizes the sun.applet.main environment to display the applets output. but in textmate the identical code generates an error which i finally have a some information about why?
the error in textmate reads
:exception in thread "main" java.lang.NoSuchMethodError: main
i am not sure whether this has to do with the import java.awt.*: or just the public void paint(Graphics g) method (code Below)
the eventual intended output of the applet is to a web browser via an html document which calls the java applet but when i run this html document both firefox and safari display blank pages.
i am on macpro with the latest java version - just downloaded last week
is there some unique import statement to utilize import java.awt.*;
import java.applet.*; in mac os or ???
BTW the smile.gif is in the project folder with the java document
thanks for any help
/*
Chapter 2: Welcome to My Day
Programmer: rafe McDonald
Date: November 5, 2009
Filename: WelcomeApplet
Purpose: This project displays a smile graphic, welcome message, the user's
name, and the system date in an applet.
*/
import java.util.Date;
import java.awt.*;
import java.applet.*;
public class WelcomeApplet extends Applet
{
public void paint(Graphics g)
{
Date currentDate = new Date(); //Date constructor
g.drawString("Welcome to my day!",200,70);
g.drawString("Daily planner for Rafe McDonald",200,100);
g.drawString(currentDate.toString(),200,130);
Image smile; //declare an Image object
smile = getImage(getDocumentBase(), "smile.gif");
g.drawImage(smile,10,10,this);
setBackground(Color.cyan);
}
}
macpro 2x 2.8 quad xeon Mac OS X (10.5.8)
mbp 2.5, Mac OS X (10.5.6)