The Wayback Machine - https://web.archive.org/web/19970626225804/http://www.ibm.com:80/java/dev_what_hot.html
IBM Network computing
Java HomeDeveloperWhat is Java?What is Java?SupportSupportRoundtableRoundtableEducationEducationBusinessWhat is Java?What is Java?Case StudiesCase StudiesViewpointViewpointIBM & JavaIBM & JavaShowcaseShowcaseAppletsAppletsReturn to TopReturn to TopReturn to TopReturn to Top * What's So Hot About Java?
  1234567

Getting Started

EDITOR'S NOTE:
Java is everywhere in the news today, but what is it really? This series of seven articles will actually take you through the steps of creating a Java applet.

A PDF version of this series of articles is available for viewing with Adobe's Acrobat(TM) Reader. A free copy of the reader is available from Adobe.

Paving the road to business on the Internet, Java transforms static environments into interactive sites.

Certainly, finding information about Java is no chore. Java is portable and architecture-neutral for any system implementing the Java Virtual Machine.

Programs written in Java can be distributed and executed on any client system that has a Java-enabled Web browser. Developers are freed from having to write multiple versions for multiple platforms and even from having to recompile for each platform. Because the applets run on the client system, scalability and performance are no longer tightly tied to Web server systems. High performance requirements are also addressed through multithreading, the ability to link native code, and the Just-in-Time compiler.
Is it a neat way to do animation over the Web or the technology that could enable the "$500 network PC"? . . . Both!
Although understanding Java may come easily, true confidence is more likely to come through actually working with it. This Website will guide you through working with the Java Development Toolkit for AIX. (Because Java is platform-independent, these exercises will work with other operating systems as well as the AIX, IBM's UNIX environment.)

You will learn to run demonstrations as well as to develop your own example applications and applets. You will see how easy it is to format graphical user interfaces and handle user inputs, to build multithreaded animations, and to communicate among applets and to servers over the network.

The examples provided in this article will provide step-by-step instructions for creating two Java applets, complete with sample code and illustrations.
Is it portable and interpreted or high-performance? . . . Both!

GETTING STARTED

Before starting, we need to get the essentials out of the way. If you haven't already installed the Java Development Toolkit (JDK) and a Java-enabled Web browser, you'll need to do so.

Once you install the JDK 1.0.2, make sure everything is properly in place by invoking the JDK demos. Figure 1 includes commands to enter at a shell (ksh) command prompt to set up and run the JDK demos.

On the export DISPLAY command, replace mydisplay:0 with your display's actual name. Note that when you enter the RunDemos command, three windows (representing the three HTML files in the Animator demo) will be displayed. These demos use the appletviewer to run the applets. The JDK provides the appletviewer, so you can view applets without a Java-enabled browser.
Is Java an object-oriented programming language or a distributed run-time environment? . . . Both!
Later, when we start writing our own applets, we'll use the Navigator browser instead of the appletviewer. If you haven't already noticed, the appletviewer has an Applet menu button. Use this button to Quit an applet, so the next demo will start.

As you invoke the applets, you should notice a few things in preparation for our later examples. First, look at the Animator applet. If you've already gone to the next applet, just enter appletviewer Animator/example1.html. In Java, basic animation is performed in one of three ways:

  • A series of images (GIF, JPEG, or XDM) are displayed in succession
  • A single image is successively redrawn at different coordinates, creating the effect of movement
  • A single image is successively enlarged or reduced, creating the effect of growth or of an explosion

The Animator applet uses the first method, displaying a series of images in succession. In fact, the Animator applet was written so you can use parameters to specify the directory where images are stored, the number of images to store, the time to pause between displaying each image, the audio files to include, and more. To get a better understanding, let's take a quick look at the applet source and images. You can view a single image in your browser by creating a file (call it /tmp/showgif.html) and inserting the line <IMG SRC = / usr/ lpp/ Java/ demo/ Animator/ images/ Duke/ T1.gif>. Then, invoke the Netscape Browser (netscape &) and set the Location field on the menu to file:/tmp/showgif.html. If the netscape command fails, try entering export LANG=C and then restart netscape.

Now let's check out the applet source. Java source code is always stored in files with the postfix .javaAnimator/Animator.java and search for the field getParameterInfo. The first column of this array lists parameters that Animator accepts. To see how to set these parameters, display the Animator/example1.html file and note the param tags. By supplying your own set of image files, you can use the Animator applet to animate any Web page.

The next installment will take you through the basic concepts of creating an applet.
Next



JavaTM is a trademark of Sun Microsystems, Inc.

Other companies, products, and service names may be trademarks or service marks of others.

Copyright    Trademark

 
network computingalphaWorksJava:  homenewsfeedbackglossaryindexvisitevents_IBM Java Development Center Solution Developer Support
IBM HomeOrderEmployment
Morty Proxy This is a proxified and sanitized view of the page, visit original site.