~ Java for Web Page Production ~

Session 1 - Learn about Java, and create your first Applet

<<  Back to Course Outline

Contents

Introduction How can Java be used Introduction to the basic JDK tools
Health & Safety
Registration
What is an Applet?  
Course aims & Objectives How can applets spice up your web pages? =+[(-:]  BREAK  [:-)]+=
Session 1 Overview Compilers & Interpreters; Bytecode  
What is a program? Java and your browser - the JVM Creating your first Applet
A brief history of Java The Java JDK (Java Development Kit) Summary & Further Sources

Introduction

Welcome to the course in Java for Web Page Production, held at Northampton College. Your course tutor is Simon Huggins, who will be taking you through and facilitating your learning of the details of this course.

The course lasts for ten weeks, with each session running to approximately three hours. Each session starts promptly at 6.00pm in order to prevent finishing too late. Refreshments will be available from 5.45pm, with a short break at around 7.45 for approximately fifteen minutes.

Each session will start with an recap of the previous session, and overview of the topics to be covered in the coming session, and at the end, a summary of that session. Each session will be taught using a mixture of seminar-style teaching, demonstration using a computer-linked projector, and a chance to try out what has been learned with a practical session.

A bit about me

I work locally in Northampton with a company called Scottish And Newcastle Retail, which owns a few thousand pubs, restaurants, and hotel lodges. They own pubs like the Rat & Parrot, Britannia, Greyhound, and Red Lion at Brafield.

I am an Analyst / Programmer working with a system called PeopleSoft that deals with accounts and Human Resources. It uses its own proprietary programming language designed for business working.

Having graduated from the University of Sheffield in 1995, I had a good knowledge of object-oriented concepts, and immediately took up a remarkable new programming language called Delphi which is still going strong today with version 6.  It took the reins from Visual Basic and introduced a visual programming environment with database facilities, and a proper structured and object-oriented programming language.

The AWT (Advanced Windows Toolkit) is the library in Java that gives you the tools to build a user interface (i.e. buttons, text-boxes, labels, pictures etc.) so that you can design how your program will look to the user. This was based largely on the design of Delphi's component scheme.

Thus, it was a natural progression to look at Java for future programming projects. I started with a language called JavaScript to create fancier web pages - specifically to create interactive web-based crosswords from my puzzle-creation program, WordPuzzle Pro.

The limitations of this language lead me naturally on to Java, which I have been researching and creating sample applications, over the last year.

I have a web site, located at http://www.simonhuggins.com which features my main interests, including the writing of software to be distributed across the internet, mostly written in Delphi.

In case you're interested, i'm married, with two inherited children and now i'm a sort-of-grandfather! At the tender age of 29! Photos are on my web site. I also have an interest in poetry, writing fiction, and somehow fell into creating a web site for fans of the US TV Series Beauty And The Beast that was around in the late eighties / early nineties.

Just goes to prove that, even in this day and age, programmers are still often strange creatures.

Health & Safety

Information will be handed out separately regarding Health & Safety. 

Registration

Registration will take place at the start of this session. At the start of each subsequent session, you will be required to sign a register to confirm your attendance.

Course aims and Objectives

The Java For Web Page Production course aims to give the attendees a good grounding of programming fundamentals, and specifically in the use of the Java programming languages to create Applets (programs that can be included in web pages).

At the end of the course, course participants should:-

Session One Overview

In this session we will be covering:-

What is a program?

A program is a list of instructions that described a task that you wish the computer perform.

In order to specify precisely your intentions, the instructions are limited to a number of core words called keywords. For example, a common keyword is IF which is used to tell the computer you wish to do something, only if something else has happened. 

This language is not understood by the computer, which uses a very fast and simplified language designed to work well with the electronic components of your computer. This is called machine code or machine language. Few people program using this directly, unless of extreme masochistic tendency.

This means that you need something that will translate the program that you have written in to machine code. This is done using a compiler. Instead, you could just translate the program straight from the source code without converting it to machine code. This would be done by an interpreter. Java uses something in-between the two of these, which will be described later.

Large programs can get very difficult to follow, and are thus split up into logical steps, each of which are called procedures. These procedures may be able to be reused in different parts of your program, thus reducing the complexity and time it takes to write your program.

Most programming languages come with a number of commonly used procedures, so that a lot of the work has been done for you. These procedures are packaged-up and put into a library.

Finally, most modern languages are in some way object-oriented. The principles of this are quite simple - imagine an object (e.g. a bicycle). It is an object. It can do various things - e.g. go, brake, accelerate and change gears. Each of these is a procedure that can be performed with the bicycle. But associated with the bicycle is various information - e.g. the make, model, current acceleration, colour, etc. These are known as attributes.

Now, let's say you wish to design a souped-up version of the sample bike - more gears, different colour, and with a bell!!! With object-orientation, rather than redoing everything again, you would borrow the design of the old bike, and just add to and replace various aspects of the object - e.g. a new attribute called bell and a new procedure called ring. Saves a lot of time. This principle is known as inheritance.

Finally, lets says we have a new object called shop. This has 50 spaces for bicycles, but until they are bought, who knows what they will be? So, we define 50 spaces that can hold a bike object (all of which share similar basic attributes and procedures) and pop different types of bikes into and out of those spaces as they are needed. In this way, we may not know in advance that the bike has a bell, but we know it can go, break, accelerate, and change gears! This principle is known as polymorphism - just to make it sound clever!

This is the basics of object-oriented programming. You build programs to reflect 'things' or objects that exist in the task or tasks you are trying to achieve.

We'll look at these concepts later and see how they can be useful in real programming.

A brief history of computer languages

In that late 1940's, a German engineer called Konrad Zuse sought a better way to program computers. He developed a system of symbols that could be used to solve problems step-by-step, called Plankalkul.

Alan Turing wrote a shorthand code for writing programs on the Mark I computer - but still pretty indecipherable to the untrained.

John Mauchly then developed Short Code which allowed equations to be entered using a special code.

Grace Hopper, inspired by this, became the first real advocate of High Level Languages - languages that are closer to language that humans might use to describe tasks.

One of the first widely-used languages was IBM Fortran, developed in the 1950's, working with mathematical data. The language ALGOL was developed in 1958, but was never as well accepted as Fortran. 

COBOL (Common Business Oriented Language) was created in 1960, to serve mainly large businesses and governmental institutes. COBOL is still widely used in industry today, especially on large mainframe computers.

In 1964, BASIC (Beginners All-Purpose Symbolic Instruction Code) was released, making programming accessible to many more people. Variants are still in wide use today - e.g. Microsoft Visual Basic.

In 1965, a language called PL/1 was introduced to be a 'cure-all' language. Being overly complex, it met with only limited success.

Simula I and 67 had little impact at the time, but introduced the early concepts of object-oriented programming that underpins most languages, including Java, used today.

In 1971, a Swiss professor called Niklaus Wirth introduced a teaching language called Pascal, which introduced important concepts in structured programming to reduce errors and increase readability.

C was created in 1972, intended as a lower-level language for writing operating systems for different computers, although its uptake has been far more universal than intended. On the surface, Java and C programs look similar - e.g. blocks are denoted by curly brackets.

Smalltalk, designed in the late 1970's, was the biggest breakthrough in many years, being both graphical and object-oriented. The concepts developed in Smalltalk contribute largely to modern languages such as C++ and Java.

ADA is used by the US Department of Defense, and was released in the early 1980's - it is large and very complex.

C++ was released in the mid-1980's to extend the popular C language to include object-oriented concepts.

Finally, Java was released in the mid-1990's to an enthusiastic audience

From this, you can clearly see that Java is only the latest in a whole history of languages. It may be that as Java is widely used, better ways of working will be discovered that fit how technology progresses. Java has the advantage in that it pre-empted a flourishing internet industry, so was in the right place at the right time, with a product that was solidly built and has thus stood the test of time.

A brief history of Java

Java was originally started as an elite project codenamed Green to find a way of allowing different electronic devices such as TV-top boxes and controllers to speak a common language. This was originally dubbed Oak but failed to find a niche despite its potential.

In 1993, the first web browser Mosaic was born, revolutionising the internet from an environment for educators and scientist to one taken up by a ever-increasing cross-section of people from all walks of life.

This changed the (now a company called First Person) team's focus to producing a software system for online multimedia. The decision was made to give the source away free on the internet.

The first oak-ready browser, WebRunner was created with the first ever applet, showing a character called Duke (which can now be found throughout Sun's Java web site) waving back at his parents. Sun decided to rename the language, to become Java.

WebRunner became HotJava due to a trademark conflict, and then in 1995, Netscape signed a deal with Sun to incorporate Java technology in its hugely popular web browser. The uptake has increased ever since.

Java has now evolved into a programming language that can be used across different computers, electronic devices, and internet browsers without having to produce different versions of the program to suit each one. This has always been a major problem for the software development industry, or lone programmer wishing to reach the widest possible audience.

How can Java be used?

In this course, we will be concentrating on using Java to attract interest in your web pages, and giving you the fundamental understanding of programming to go on to create Java Programs to suit your own purposes.

However, Java has been taken up voraciously by many developers across all major industries, and the need for Java programmers has thus rocketed, such that demand far exceeds supply. For this reason, Java programmers are currently earning good salaries (typically £30-£40k+) and enjoying being on the cutting edge of technology.

So why has Java been taken up by big business as well as the small developer producing a web site, or simple applications to share with net surfers?

The biggest reason is interoperability or the ability to write a Java program for one computer, and be able to run it on virtually any computer that can run Java programs (and due to Java's popularity, most computers can) with little or no change in the program. This might seem an obvious need, but until Java, there was no universally accepted language that could work across different types of computers.

Java can be run on computers called web servers - these are the computers that you are linking to when you are browsing the web, and contain web pages to send back to your computer, or instead, programs that determine how the web pages should look when they are viewed on your computer.

So Java can be run on servers as well as clients (that's your computer when you're browsing the internet) - another advantage. It can also be used to link to stores of data called databases, it can control how to communicate with other computers across the internet in a variety of ways, it can create real-time three-dimensional games that run from your web browser. In short, it can cope with the majority of common computing tasks that you choose to throw at it.

Finally, Java can also be used to program electronic devices - and as a result of its innate ability to talk to other computers across the internet, this allows for devices that can talk to each other, or that can be controlled across the internet from, say, your web browser. Uptake for this technology has been quite slow, largely due to this being a fairly young and volatile part of the industry, but is increasing.

So what are it's shortcomings? Well, Java is owned by Sun microsystems, who thus control how it develops, although they do generously allow anybody to freely download the tools required to get going with programming in Java (the JDK - Java Development Kit). This means that other companies who wish to produce competing products (e.g. Microsoft with its .net project) will naturally wish to squash its use in  industry as much as possible. For example, in the Microsoft's latest Windows XP operating system, Java does not come bundled with the web browser as it has done before - you will need to download Java from Sun's web site before Java Applets will work OK. However, many computer manufacturers such as Dell and Compaq have chosen to pre-load Java onto their new PCs, so this may not be a real problem.

Java has traditionally had a reputation for being slow. This is inevitable, as the programs must be independent of the different languages that different computer processors understand (known as machine language or machine code). However, as processor speeds have increased, and Java technology has improved (with such help as Just-In-Time Compilers - where the code gets converted into machine code just when the Java program is about to be run) this barrier has been less noticeable.

Despite Microsoft's competition, Java looks set to maintain prominence in the computing world - partly due to its continuing evolution, partly because a lot of people are now using it, and partly because it has such a solid basis on which to build virtually any type of application, aided by the frenzy of activity in trying to get anything and everything connected to the internet.

Indeed, a recent report released by Evans Data Corp [eWeek 16-08-2001] indicates that in the US, Java is set to overtake the use of both C++ and Visual Basic next year, with an estimated 60% of developers using Java.

What is an Applet?

An applet is a Java program which can be put on a web page amongst the rest of your content . If you browse the web regularly, you will undoubtedly have come across examples of Java Applets - they tend to start as grey boxes which burst into life once the Java program has been loaded and starts.

Creating an applet is a fairly simple process:-

A more technical explanation of an Applet is that it is a Class (or program) that inherits (reuses) the details of the Applet Class, and uses and extends these details to form an application that can be used within a Java-enabled web browser. The first sample of a Java application given later in this session will demonstrate this more effectively than this somewhat vague description.

How applets can spice up your web pages

So what's the point? There are alternatives to Java. Let's go through a few of them and highlight a few pros and cons:-

Platform Pros Cons
Java Free; Well-used; Extensive capabilities; Lots of good on-line resources; Multi-Platform; Programmable;
Transferrable skills.
Not compiled, so fairly slow; Daunting to the beginner;
Tools for Java tend to be geared to the programmer.
     
Flash Commercially supported; Fast (to paint & load) animations; Geared to presentation; available on several platforms; Programmable if purchase developer version. Costs £300+;
Restricted Programmability;
Updates infrequent;
Skills not transferrable to other types of programming
     
DHTML Free; Special graphical effects, including moving objects; Programmable On-line resources limited; Little used; Incompatabilities between browsers; Limited effects and programmability.
     
JavaScript / HTML Free; Well used and known; Good on-line resources; Programmable;
Good for form-filling and triggers,
Limited capability; Relies on page being static; 
     
GIF animations Free tools available; Animations or still pictures Not programmable; GIF format is patented; Image can be animated, but cannot itself move.

  It is not uncommon to mix these methods, even in the same page, according to the suitability to the task - e.g. use GIFs for banner ads, JavaScript and HTML for form-filling, and Java for a more interactive section, or news-banner.

Common uses for Java Applets might be to create interactive games (e.g. arcade games, crossword or other word-puzzle, etc.), to show scrolling banner-style text, to create graphical eye-catching animations, to connect to another computer (e.g. using a Telnet or Chat session), and so on...

Compilers and interpreters; Bytecode

When you write your list of instructions for the computer to perform a task, called a program, you have to write it using one of the many available programming languages available today - Java, C, C++, Pascal, BASIC etc. etc.

Once you have created your instructions, you will need to start a program called a compiler, which will take your instructions, an translate it into a form understood by the computer that the program is being created on - effectively, it translates a language you can understand reasonably well to a language the computer can understand.

Many compilers have an in-between stage, where the original program (source code) is converted to something called object code - this is often used to package up procedures into libraries, so that they can be distributed to other programmers, without them being able to see (and thus copy) the original source code. It also tends to be a lot smaller in size than the original source code, and can also be scrambled for extra security.

This object code can then be converted into machine code.

Java goes one step further. When a Java program is compiled, it produces a language known as bytecode - which is quite similar in principle to object code. This bytecode can be packaged into libraries, but even more useful, the same bytecode will be created whichever computer is being used. Thus, the bytecode can be used on any computer, and is a lot more efficient to execute than the original source code, if not quite as fast as the computer's machine code.

The final stage is that the bytecode is read by the Java Virtual Machine, and translated to machine code as it reads the bytecode.

Thus, the bytecode can be used on any computer that has a copy of the Java Virtual Machine on it - i.e. most computers with Web Browsers.

Java and your browser - the JVM

The Java Virtual Machine is a rather grand sounding name for quite a simple concept.

In days gone by, there were several languages (as we saw earlier), each of which would compile (produce) different final machine code (i.e. language that a computer can understand). Moreover, each type of computer, and operating system (e.g. Windows 3.1, Windows 95, Windows 2000, Unix, MacOS, etc.) would need to produce different machine code for the specific machine/operating system combination.

In simple terms, each computer speaks a different language, and programmers were writing in different languages too. And then everyone wanted the different programs/computers to talk to each other. Mayhem and confusion ensued.

The Java Virtual Machine and the Java language sought to remove this confusion. The Java Virtual Machine is a translator that takes the highly optimized (i.e. designed to execute as quickly as possible) Java Bytecode (described in the previous section) and converts it into machine language that is understand by a specific computer.

Thus, every computer that has a Java Virtual Machine can run Java programs. And most computers (desktops, laptops, servers and hand-helds) do have a JVM, because it makes the computer more appealing, as it can then execute a lot of programs written in Java.

In fact, it is possible to take programs written in other languages than Java, and convert them to produce Java ByteCode - thus, the original language you wrote the program instruction in, does not necessarily even need to be Java. There are obviously complications with this!

One note - after version 1.1 of Java, the Java Plug-in was introduced, which introduced new facilities for better Java applications. This 'plugs-in' to your browser so that it can run Java applications, but web pages that make use of v1.1 or later must use applets in a slightly different way. One further advantage of this is that although Microsoft has not updated the version of the Java JVM in its browsers since version 1.1, the plug-in it can be downloaded from Sun to give the latest enhancements, and as a plug-in, can be downloaded automatically when your browser detects it is needed. 

The JDK (Java Development Kit)

The Java Development Kit (JDK) is a set of programs that form the basis of writing applications in Java. They are available for free (downloadable from the java.sun.com site). The JDK also contains documentation, samples, and a full class library that lets you perform a host of tasks on your computer.

The tools include a compiler for translating the Java source language to bytecode, a Java Application (bytecode) runner, a Java Applet (bytecode) runner, a documentation tool, a library packaging tool, several security tools, and several other smaller utilities.

As the JDK is freely available, we will be using this for the majority of our work on this course.

Integrated Development Environments (IDEs) - QuickCup

There are also available several tools that build on the JDK to provide what is known as an IDE (Integrated Development Environment). This combines several of the tools, plus form-designing and on-line help in a single application. This can be very useful for larger-scale projects, but can take some getting used to. Sun provide a free-to-use application called Forte for Java Community Edition, and Borland provide an excellent tool called JBuilder 5 PE (Personal Edition) - some instructions for installing this are available as extra documentation for this course.  There are several other products from industry leaders such as IBM, MicroSoft, and Symantec.

On this course, we will be utilizing a cut-down IDE which is adequate for the purposes of creating Java Applets for the web, and much easier to learn than the tools described above. The application is called QuickCup and has been written by the tutor of the course with teaching in mind. The application is FreeWare, so feel free to distribute it to others (but not for profit) or use it yourself at home. 

The application QuickCup lets you create Java projects, into which you can add any java / html etc. source files, and edit, compile, test and package them for distribution. However, it doesn't cater for more involved tasks, such as integrated debugging, form design, and context help. More on QuickCup later.

Introduction to the basic JDK tools

The JDK has a number of tools. These are listed below. The most important program must be javac which checks your source code to see if it is correct, and if it is OK, generates java bytecode. You can then test that this works OK using either the appletviewer program, or direct from your web browser!

Pretty straightforward!

Text Editors

It may seem odd that one of those tools is not a source code editor! This is because an editor is something that tends to be an individual choice, and every computer has its own standard text editor(s), so this is not a necessary part of the JDK tools.

A text editor is a program, rather like a word processor, that allows you to type in source code (e.g. Java language commands), save them to a disk file, print them out, and change them to correct problems or add extra commands.

The standard text editor for PCs running a variant of windows is the notepad program. To start-up notepad, click on the Start button at the bottom-left hand corner of the desktop, click on the Programs menu, then the Accessories menu to the right, and finally click on the Notepad application.

You may choose to use Notepad in your own development, as it is available on all PC Windows computers. However, in this course, we will be using the QuickCup IDE.

Program Description
javac The Java compiler. Converts Java Source Code into bytecode.
java / jre The Java interpreter. Takes bytecode (stored in .class files) and executes it in a language that the computer understands.
appletviewer As java, but takes a HTML file and runs an Applet as it would appear in a browser.
jar Java ARchiver program. Creates JAR files, which are libraries of multiple Java Classes and resources, packaged up into a single compressed file. Great for distributing an application, for example, via the internet.
javadoc Java source code documentation generator program. Creates HTML documentation based on the source code, and the comments within the source code.

There are several other applications within the JDK tools, but these are for advanced use - e.g. relating to security, testing server-based Java applications (servlets), Remote Method Invocation, Debugger etc.

Creating your first Applet

This should launch the QuickCup IDE, and automatically load the sample project, TextBurst. This application demonstrates a simple Applet to show some text whizzing towards and away from you periodically, changing colour gradually as it moves. It could, for example, be used as an eye-catching heading on a web page.

The main QuickCup screen is shown below as a sample:-

To look at the JAVA source code that gives the instructions for how to do this, click on the TextBurst.java tab. The source code should be as follows:-

Java Source Code
/*
** TextBurst sample applet
**
** by (c) Copyright 2005 Simon Huggins
** 
** For demonstration purposes only.
**
** You may use this applet on your web site, but it cannot be
** sold in either its original or altered state.
** This original notice must be included in all versions of
** the applet distributed, even if altered.
**
** The author accepts no liability for any difficulties or loss
** arising from use of this applet. It is primarily intended for
** demonstration purposes.
**
** Change History
** ~~~~~~~~~~~~~~
** 17-Sep-2001  v1.0  Release version
*/


/*
** Import section - tells the compiler where to look for different classes
** used within this file
*/
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;


/*
** Defines a class called TextBurst which takes the basic JApplet
** class as a template, and adds to it to create our Applet.
** It also implements something called ActionListener which is an
** Interface for the purposes of checking when an event has occurred.
*/
public class TextBurst extends JApplet implements ActionListener {

  static int maxChangeAmount = 20; // Constant value to define the
                                   // max. speed of colour change

  Timer timer;  // Used to update the display ever 50ms
  JLabel theLabel; // The label that shows the text
  int fontSize = 2; // Initial font size (in points)
  int fontDirection = -1; //How much the font size will shrink (minus) or grow by
  int maxFontSize; // Maximum font size
  int redAmount = maxChangeAmount;
  int redDirection = - Math.round((float)(Math.random() * maxChangeAmount + 1));
  int greenAmount = maxChangeAmount;
  int greenDirection = - Math.round((float)(Math.random() * maxChangeAmount + 1));
  int blueAmount = maxChangeAmount;
  int blueDirection = - Math.round((float)(Math.random() * maxChangeAmount + 1));
  Color appletBgColor;  //background color for the applet

  /*
  ** Initialize the applet - i.e. set up any values before processing begins
  */
  public void init() {
    String burstText = getParameter("burstText"); // get the text parameter from the HTML page
    timer = new Timer(80, this); // Define a timer so actionPerformed gets called every 50ms

    String fontSizeString = getParameter("maxfont"); // get font size as a string from HTML
    if (fontSizeString != null)  // check if the parameter was used
      maxFontSize = Integer.parseInt(fontSizeString);  // if so, convert it to an integer
    else maxFontSize = 20;  // if not, use 20 as a default.

    String appletColorStr = getParameter("bgcolor"); // get color as a string from HTML
    if (appletColorStr != null) { // check if parameter used
      appletBgColor = new Color(Integer.decode(appletColorStr).intValue()); //decode hex
    }
    else appletBgColor = Color.lightGray;  // if not, use light grey.

    theLabel = new JLabel(burstText,SwingConstants.CENTER); // Define a centred label
    theLabel.setForeground(new Color(redAmount,greenAmount,blueAmount)); // Set its colour
    theLabel.setFont(new Font("Helvetica",Font.BOLD,fontSize)); // and its font type
    getContentPane().setBackground(appletBgColor); // Set the Applet's background color
    getContentPane().add(theLabel); // and add it to the applet
  }

  /*
  ** Defines what should happen when the applet starts - e.g. after return to page
  */
  public void start() {
    if (!timer.isRunning()) timer.start(); // start the timer running
  }

  /*
  **Defines what should happen when the applet stops - e.g. when leave the page
  */
  public void stop() {
    if (timer.isRunning()) timer.stop(); // and stop it again
  }

  /*
  ** ActionListener Interface method called by the Timer every 50ms
  */
  public void actionPerformed(ActionEvent e) {
    /* If the font size reaches 20 or 2, reverse the direction of shrinking / growing */
    if ((fontSize==maxFontSize) || (fontSize==2)) fontDirection = -fontDirection;
    fontSize += fontDirection; // shrink or grow the fontSize by this amount
    theLabel.setFont(new Font("Helvetica",Font.BOLD,fontSize)); // change the font size

    /* These sections change the three colours in a similar way to the font size */
    redAmount += redDirection;
    if ((redAmount<=10) || (redAmount>=250)) {
      redDirection = -redDirection; redAmount += redDirection;
    }
    greenAmount += greenDirection;
    if ((greenAmount<=10) || (greenAmount>=250)) {
      greenDirection = -greenDirection; greenAmount += greenDirection;
    }
    blueAmount += blueDirection;
    if ((blueAmount<=10) || (blueAmount>=250)) {
      blueDirection = -blueDirection; blueAmount += blueDirection;
    }
    theLabel.setForeground(new Color(redAmount,greenAmount,blueAmount)); // set the colour
  }

  /*
  ** Define information about the applet - in Appletviewer, see Applet | Info menu
  */
  public String getAppletInfo() {
    return "Title: TextBurst\nAuthor: Simon Huggins\nDisplays a text burst effect"; }

}

If you click on the TextBurst.htm tab, this shows a sample web page that contains this applet, and should be as follows:-

HTML Page to launch above applet (works with MicrosoftTM Internet Explorer)
<HTML>

<HEAD>
<TITLE>TextBurst 1.0</TITLE>
</HEAD>

<BODY bgcolor="#FFFFC6">

<HR>

<p><big><b>Following will work on a web page run from Internet Explorer:-</b></big></p>
<p align="center">
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="500" height="50" align="baseline" 
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME="code" VALUE="TextBurst.class">
    <PARAM NAME="codebase" VALUE="./">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME="burstText" VALUE="Java for Web Page Production - TextBurst v1.0">
    <PARAM NAME="maxfont" VALUE="22">
    <PARAM NAME="bgcolor" VALUE="#FFFFC6">
    <PARAM NAME="scriptable" VALUE="false">
        No Java 2 SDK, Standard Edition v 1.3 support for APPLET!!
</OBJECT>
</p>

<HR>

<A href="TextBurst.java">The source.</A>

</BODY>

</HTML>

The QuickCup toolbar

If you hover your mouse over the buttons on the toolbar, you will see that each has a name - the first (should be greyed) is Save (disk - ), and on its own. This saves any changes to the project and/or source files within the project.

The remaining buttons are grouped together, as they act on the source files within this project. They are (from left to right):-

Compile the Applet

To compile the applet - i.e. check the source contains the correct language (syntax) for the instructions to be understood, and convert those instructions to Java Bytecode - click on the Compile () button.

This will show the Console window, which shows any messages from the compilation process. No messages means no errors.

Note that you can execute these commands outside of the QuickCup IDE using the command-line. If you are unfamiliar with application development in this way, then it is best not to attempt this. However, you can see the JDK tools that are being executed to perform the tasks in the console window. A successful output is shown below:-

Test the HTML web page

Now that the bytecode has been generated by the compiler, you will be able to use it from the sample web page:-

Change the parameters from the web page

We are now going to change one of the parameters (information going in) to the applet from the web page. Specifically, we will change the text that is displayed in the applet:-

Summary

This week, we have covered a lot of groundwork information that will help with following weeks.

Do not worry if it all seems a little much at this stage - this week was merely a 'taster' - if you understand everything about how the application worked by now, then you must be a real Java Genius!

Briefly, we have covered:-

If you would like to download any of the information, samples, applets, or applications mentioned this week, they will be available as from the day after this session. This will be the same each week. Point your browser at http://www.simonhuggins.com/courses/javaweb/index.htm and browse away!

Next Week...

The sample applet chosen demonstrates a number of important aspects of Java development. We will be looking into how it is structured next week, and making some alterations to improve how it works, and how we can control it from the web page.  We will also start getting down to some theory about how to construct Java applets for yourself, and some basic programming techniques:-

In particular, we will be covering:-

Summary and Further Sources

Java Virtual Machine Sun site (JVM Specification) -
http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html
Plug-in HTML Specification (http://java.sun.com/products/plugin/3.1/docs/tags.html)
Java Run-Time Download (http://java.sun.com/j2se/1.3/jre/download-windows.html)
Integrated Development Environments Sun site (Forte for Java) - http://www.sun.com/forte/ffj/
Borland site (JBuilder 5 PE) - http://www.borland.com/jbuilder/personal/
Arctan site (TextBurst IDE) - http://www.simonhuggins.com/arctan/textburst/ 
Extra course documentation (JBuilder 5 PE)