autodesk 3ds max 2012
office visio premium 2010
microsoft visual studio test professional 2010
microsoft office 2011 home & business mac
Symantec Norton Ghost 12.0
windows xp professional sp3 (32 bit)
RosettaStone Japanese Level 1, 2 & 3 Set
windows vista business
Knoll Light Factory for Photoshop 3 MAC
autodesk 3ds max 2012
autodesk autocad raster design 2011
autodesk autocad revit architecture 2009
cs5 production premium mac
illustrator cs4 mac
GFI MailSecurity 10.0
microsoft office 2010 home and student
autodesk mudbox 2012
Apple Motion 5 MAC
after effects cs4 mac
Applets versus Applications
Applets
An applet is a Java program that is designed to run on the web. Creating an applet requires two distinct programs:
- JAVA Program: The java program contains the code that we wish to run on the web.
- HTML "Program": The HTML program contains a tag that loads the desired applet.
Creating the Java Applet. As our first example of a Java applet, we'll create a simple program that prints Hello, world,
your name, and the current date on a web page. The following picture contains the Java applet.

There are several crucial features to this short program.
- import: Java applets require classes and methods found in the standard Java class libraries.
Since these classes
and methods are not necessary when creating applications, they are not loaded when we compile a Java program.
The import
statements load the necessary Java class libraries. The three import statements are those
typically used in most Applets.
- public class Hello extends JApplet. The basic programming unit in Java is a class.
Java classes always begin with a capital letter.
This line contains two classes: Hello and JApplet. We are creating the Hello class based on the built-in Java JApplet class. One way to base a class on another class is to extend a class. Notice the use of public.
This indicates that anyone can use this class.
The same is true for the method, paint().
- public void paint(Graphics g): paint() is a method found in the JApplet class. This particularly method draws objects on a
Graphics object. Thus, it requires a Graphics object to do its job. We give it the required Graphics objects by enclosing it in
(). Anything enclosed in parenthesis is an argument. Think of it like a mathematical function such as f(x) = x+1. x is the argument
to the function. Our math function returns a value, which is x + 1. In Java, the value to be returned is specified after public. In
this case, void indicates that paint() does not return a value; it simply performs a task.
- g.drawString(): The parenthesis tell us that drawString() is a method. The g. tell us that this method is found in the Graphics
class. This method requires 3 arguments: the string to be drawn, the x (or column) coordinate, and the y (or row) coordinate. Notice
that we do not use public void with drawString(). This is because we are simply using the drawString() method, while we are
creating our own version of the paint() method.
- public void start(){}. If you're using a different version of the compiler, you may need to include a start() method. The method should go before the paint() method.
The program listing then becomes:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class Hello extends JApplet
{
public void start(){}
public void paint(Graphics g)
{//Write a message on the page
g.drawString("Hello! This is my first Java Program!", 15, 20);
g.drawString("This is SAF.", 15,38);
g.drawString("January 11, 2006", 15, 50);
}
}
|
Compiling the Java Program: To compile the program we use the java compiler, javac.
The compiler creates a new version of our program,
known as byte code. This new program has an extension of .class. This is the program that we include in our
web page.
The following picture
show how to compile our program. Notice that the name of our file matches the name of our class.
The Web page: Web pages are written in HTML. HTML is a markup language, and not a
programming langauge. It contains tags denoted by Angular brackets <>.
Most tags, but not all come in pairs. For example, an html program beging with <HTML> and ends with </HTML>.
The following picture shows a simple HTML program that runs our Java applet.
Notice the <APPLET> tag. This tag contains a CODE field that
specifies the name of the Java Class, as well as the width and length.
Determining the width and length is a matter of guess work (or running
the programming through the AppletViewer).