Files and pieces for making a Java Applet

Applications

These are computer programs that work on your mac or PC.  You'll need two types of applications:
  A Web browser application such as Firefox or Internet Explorer.  This application shows web pages and can run and display Java applets.
A text editor application, such as Simple Text or Microsoft Word or BBEDIT.  This application allows you to create and modify plain text files.  You will create your java programs and web pages using a text editor application.
A java compiler.   This application converts a java source program (see below) to a form that may be run by a web browser 

Plain text files stating what you want the computer to do.

  A web page file, such as "Explore.html".   Web pages are generally indicated by the suffix html in the file name.  The hallmark of an html file is that the plain text within starts with "<html>".... e. g.
<html>...

<applet ....   >

</html>

A java program (or java source program), such as Explore.java.  Java programs are structured as described in the text.  We shall mostly deal with a form of java program called an Applet.  These generally look roughly like
// some text, describing what the program does
import java.awt.*;
...
public class Explore extends Applet {
...
}

The compiled java program

The compiled java program, such as Explore.class.  A java source program must be converted to this compiled form before it can be executed.  This conversion is done by a "java compiler" defined above.The contents of this file aren't readable as text and can't be usefully modified by .  We shall compile programs by using a remote compiler at the web page http://koch.uchicago.edu/java/
 

Steps in preparing a java applet for running

1. Write the program,  by typing, cutting, pasting, into a text application .

2.  Compile the program  by running the compiler  and giving it  as its input.  This produces the compiled program  .

3. Write a web page  which asks the web browser to run the compiled program .

4.  Tell the web browser to go to your web page .  This causes the applet   you wrote to be executed.

 

Chain of events when a java applet runs.

1. user asks browser  to display a web page  , such as Explore.html

2. Browser  encounters an <applet tag.  This makes it start its java "virtual machine"

3. The virtual machine runs the compiled program  Explore.class specified in the <applet tag.

4. One of any Java's functions while running is to invoke certain functions (or methods if these have been defined by an applet. For example, Java invokes any paint methods whenever it senses that the window needs to be redrawn.

5. the paint procedure written in tells how to write the desired numbers on the screen.