Java Applets and Channels: Without Programming

Java Applets and Channels: Without Programming

Paperback(BK&CD-ROM)

$31.70 $37.95 Save 16% Current price is $31.7, Original price is $37.95. You Save 16%.

Overview

Java applets or programs can be used to enhance the appearance and operation of a Web site. In easy-to-understand language this book explains how to use the Java applets that are found on the included CD-ROM. Because the applets are already developed and provided, no programming is required. While content is still the king of the Web Page, these Java applets make a site more attractive and user-friendly.

Product Details

ISBN-13: 9781884777394
Publisher: Manning Publications Company
Publication date: 08/01/1997
Edition description: BK&CD-ROM
Pages: 350
Product dimensions: 7.06(w) x 9.03(h) x 1.01(d)

About the Author

Singer is a Principle in McKinsey's San Francisco office, where he coleads the firm's continuous relationship marketing practice.

Read an Excerpt


Chapter 10: Misc. Applets

 

10.1.8 Lightning Animation

The Lightning Animation applet displays a city skyline at the bottom of a large sky with a lightning storm in progress (figure 10.8). As you watch, the lightning flashes and the sky changes colors with the flashes of lightning. The attention-grabbing display can help draw attention to your Web page.

Sample HTML code

Use the following HTML code to include Lightning Animation in your Web page:

<applet code=Lightning.class width=72 height=72>
</APPLET>

Parameters

Other than the usual height, width, code, and codebase parameters, Lightning Animation does not use parameters.

 

10.1.9 Linear Ballet

The Linear Ballet applet displays a set of lines that moves around the applet area in a predictable and enjoyable fashion (figure 10.9). Linear Ballet makes a simple yet pretty pattern that can be used for a logo or other decoration. Figure 10.10 shows the Linear Ballet sample Web page from the CD that comes with this book.

Sample HTML code

Use the following HTML code to include Linear Ballet in your Web page:

<applet code="LinearBallet.class" WIDTH=400 HEIGHT=200>
</APPLET>

Parameters

Other than the usual height, width, code, and codebase parameters, Linear Ballet does not use parameters.

 

10.1.10 Little Wire Doo-Dad

The Little Wire Doo-Dad applet displays a constantly rotating, wire-frame model inside the applet area (figure 10.11). The model rotates around each axis, which is an instance of a class. The applet is single-threaded and double-buffered.

Sample HTML code

Use the following HTML code to include Little Wire Doo-Dad in your Web page:

<applet code="wire" width=100 height=100>
<PARAM name="rgbfgcolor" value="aa0000">
<PARAM name="rgbbgcolor" value="ffffff">
<PARAM name="axis" value="10">
<PARAM name="delay" value="20">
</APPLET>

Parameters

In addition to the usual height, width, code, and codebase parameters, the parameters you can use with Little Wire Doo-Dad are as follows:

rgbfgcolor This is the color for the wire figure, in hexadecimal.

rgbbgcolor This is the background color, in hexadecimal.

axis This is the number of axes to include in the figure. The higher the number, the more complex the figure and the more complex its rotations.

delay This is the time, in milliseconds, to delay between movements.

 

10.1.11 Map applet

The Map applet displays a map on the screen. Figure 10.12 shows a full scale and a zoomed view. You can zoom in or out by clicking on the magnifying glass with the plus to zoom in or the minus to zoom out and then clicking on the map. These are the first two magnifying glasses in figure 10.12.

The third magnifying glass in figure 10.12 lets you center the map. After clicking on this magnifying glass, you click on the part of the map that you wish to be the center of the map and the applet moves the map accordingly. If needed, it will go out to the database and retrieve additional information in order to fill the area with a world map

The fourth magnifying glass in figure 10.12 lets you highlight a box on the map. This highlighted area then expands to fill the entire map area. The fifth magnifying glass in figure 10.12 brings up a dialog box that displays the latitude and longitude of the point on the map under the mouse pointer. It also uses a drop-down list box to allow the user to change the magnification. The sixth magnifying glass lets you add a URL to the map, and the seventh lets you change the colors used to display various items and even turn off the display of some items.

Drop-down lists at the top of the map let you go to certain areas and select the resolution of the map. Resolution is discussed in more detail below..

Map source

Digital Chart of the World (DCW) is used for the mapping data. The server will actually support any Vector Product Format (VPF) database, but currently the only VPF database that is public is the DCW database. All five DCW libraries are now on-line.

Can I get a copy of the server?

No. The source code to the applet is available, but neither the VPF library nor the server is available to the public. However, this does not prevent you from using the Map applet on your Web page; it can be used without having the server source code. The HTML code to do this is shown below.

Sample HTML code

Use the following HTML code to include the Map applet in your Web page:

<applet codeBASE="http://maps.purple.org/map" CODE="MapApplet.class"

<PARAM NAME=LAT VALUE="45.0">

<PARAM NAME=LON VALUE="-90.0">

<PARAM NAME=SCALE VALUE="2">

</APPLET>

Parameters

In addition to the usual height, width, code, and codebase parameters, the parameters you can use with the Map applet are as follows:

lat This is the latitude of the center point of the map.

lon This is the longitude of the center point of the map.

scale This is the size of the map. Size 2 is the default. A larger number displays a smaller area.

What does accuracy do

The accuracy menu controls how many points are sent to the client. Point clipping is used to reduce the huge amount of data involved when sending the vectors to the client. This is very helpful for people using 28.8 modems. For example, in World View, 290K of data is used to send all the points with full accuracy selected, 118K with the default medium, and only 67K when in poor accuracy mode.

 

10.1.12 Modem

Modem is a simple applet that displays a picture of an external computer modem on the screen, complete with flashing lights (figure 10.13). The flashing lights do not have any meaning. That is, they do not correspond to underlying functions being performed by the computer. Figure 10.14 shows the Modem sample Web page from the CD that comes with this book.

Sample HTML code

Use the following HTML code to include Modem in your Web page:

<applet code="Modem" width=30 height=10>
</applet>

Parameters

Other than the usual height, width, code, and codebase parameters, Modem does not use parameters. The correct size for the applet is 30 x 10. No other size is useful.

 

10.1.13 Moir? Patterns

A Moir? pattern occurs when two similar, repeating patterns are almost but not quite superimposed. The Moir? pattern is a kind of interference pattern. The basic pattern consists of lines radiating out from a common center. One copy of this pattern is fixed, and the other drifts about, creating a changing interference pattern.

Moir? patterns can be very hypnotic and is not unusual for people to stare at them for long periods of time. While this can help grab attention for your Web site, it can also direct attention away from your message. For this reason, you should use Moir? patterns with care when looking to attract attention.

The Moir? Patterns applet allows you to display and manipulate moir? patterns on your Web site (figure 10.15). Using the built-in controls, you can select the background along with its size and spacing, the foreground along with its size and spacing, and the rotation and its step. For background, you can choose among concentric circles, radial lines, parallel lines, or trigrid lines. For the foreground, you can choose between parallel lines or trigrid lines.

Sample HTML code

Use the following HTML code to include Moir? Patterns in your Web page:

<applet code="Moire.class" width=512 height=384>
</applet>

Parameters

Other than the usual height, width, code, and codebase parameters, Moir? Patterns does not use parameters.

 

10.1.14 Moire1

Moire1 displays moir? patterns on the screen (figure 10.16). You can start and stop the applet by shift-clicking on the pattern. You can also click-and-drag to control the motion of the pattern yourself. Moire1 is highly configurable with respect to the color of the lines, the background, and the border. Figure 10.17 shows the Moire1 sample Web page from the CD that comes with this book.

Sample HTML code

Use the following HTML code to include Moire1 in your Web page:

<applet code="Moire1.class" height=200 width=200>
<param name="bgColor" value="yellow">
<param name="lineColor" value="0 180 0">
</applet>

Parameters

In addition to the usual height, width, code, and codebase parameters, the parameters you can use with Moire1 are as follows:

bgcolor This is the background color, specified by giving the name of the color.

linecolor This is the color for the lines used to construct the moir? pattern, specified using decimal values separated by spaces.

 

10.1.15 The Particle Tree

The Particle Tree draws rough drawings of trees using a technique based loosely on particle systems (figure 10.18). Obviously, Particle Tree is not an applet with general uses.

Figure 10.19 shows the Particle Tree sample Web page from the CD that comes with this book.

Sample HTML code

Use the following HTML code to include the Particle Tree in your Web page:

<applet code="particleTree.class" WIDTH=200 HEIGHT=300>
</APPLET>

Parameters

Other than the usual height, width, code, and codebase parameters, the Particle Tree does not use parameters.

 

10.1.16 The Poetry Gallery

If you are running a Web site devoted to poetry or writing, then you are going to want to include a copy of the Poetry Gallery applet as a fun diversion. When it starts, The Poetry Gallery displays a screen similar to the one in figure 10.20. This screen has a collection of words and phrases placed individually on blocks. You can rearrange these blocks to write poetry, or anything else for that matter. To remove extra blocks, just drag them off the applet area. Figure 10.21 shows several poems written with The Poetry Gallery.

Sample HTML code

Use the following HTML code to include The Poetry Gallery in your Web page:

<applet code="PoetryApplet" height=425 width=500>
</applet>

Parameters

The Poetry Gallery does not use any parameters other than the usual height, width, code, and codebase parameters.

 

10.1.17 Simple 3-D Viewer

This applet reads and displays three dimensional files in the OFF file format, one of the file formats used by the Geometry Center 3-D viewer Geomview. Two views of the same 3-D object are shown in figure 10.22. To rotate the object, you simply click on it and drag it. You can move objects along any of three axes. Simple 3-D Viewer uses the painter's algorithm for polygonal sorting, which often does not produce a correct rendering so objects may appear less than perfect.

Unless you are running Geomview or are a 3-D modeling whiz, you would find this applet to be of limited use. It is nearly impossible to find OFF-format objects on the Web except in the Geomview software package.

There are two versions of this applet, one embedded and one not. The above describes the not embedded version. The embedded version does not open a separate window in the browser.

Sample HTML code

Use the following HTML code to include Simple 3-D Viewer in your Web page:

<applet code="ThreeD.class" width=0 height=0>
</applet>

Parameters

Other than the usual height, width, code, and codebase parameters, Simple 3-D Viewer does not use parameters.

 

10.1.18 Stars Applet

The Stars Applet displays a moving star field against a black background. It is similar to a popular screen saver option in Windows 95. You can't do much with Stars Applet, but it's so pretty (figure 10.23)! Be sure to click the mouse on the stars. Figure 10.24 shows the Stars Applet sample Web page from the CD that comes with this book.

Sample HTML code

Use the following HTML code to include Stars Applet in your Web page:

<applet code=StarField.class WIDTH=500 HEIGHT=500>
<PARAM NAME=STARS VALUE=200>
<PARAM NAME=SPEED VALUE=15>
</APPLET>

Parameters

In addition to the usual height, width, code, and codebase parameters, the parameters you can use with Stars Applet are as follows:

stars This is the total number of stars to display.

speed This is the thread delay for each iteration, in milliseconds.

type This is the type of star field. There are two types: 0, which has small stars, and 1, which has larger stars.

 

10.1.19 TimeGraph

The TimeGraph applet is useful for displaying graphs of dynamic data, such as network or Web server statistics. The applet can display up to eight graphs at the same time. The program recalibrates its scale automatically to fit the data. There is a zoom function so you can inspect parts of the graph in more detail (figure 10.25). Figure 10.26 shows the TimeGraph sample Web page from the CD that comes with this book.

Syntax for both the TimeGraph applet parameters and for the statistics file are rather tricky. Read the documentation carefully.

The statistics file format

The data for the graph is displayed in a separate ASCII file. This allows you to update the graph without having to modify the underlying HTML file. Each line in the statistics file represents a single set of statistics at a specific time, for a number of different groups of parameters. Each group represents one entityÑfor example, an individual link to another siteÑand within each group is a number of different parameters. It is possible to use this applet to display data dynamically (on the fly), but in order to do that you need a dynamic data source, say from a CGI program. The author's documentation explains how to do this.

The timestamp is separated from the groups by white space (one or more spaces or tabs), and the groups are also separated from each other by white space. The end-of-line character signifies that there are no more statistics from that point in time.

The timestamp takes the format "HH:MM Day dd/mm/yy". To use U.S.-style dates, 19:20 Sun 03/17/96, use the usdates applet parameter. Each group looks like:

name="groupname",param=value[,param=value...]

Each group must have a name string parameter, and all the parameters apart from the name must be numeric, either in floating-point or integer representations. Scientific notation is not supported. Figure 10.27 shows the top of the data file used to create the graph shown in figure 10.25.

Sample HTML code

Use the following HTML code to include TimeGraph in your Web page:

<applet code="TimeGraph.class" width=500 height=300>
<param name="cabbase" value="TimeGraph.cab">
<param name="src" value="Dublin-Inet">
</applet>

Parameters

In addition to the usual height, width, code, and codebase parameters, the parameters you can use with TimeGraph are as follows:

src This is the name of the statistics file.

graph# This specifies which series to graph where # takes on the graph number 1-8.

markdaytime This parameter causes the applet to differentiate between night and day, where daytime is between 8 a.m. and 6 p.m.

markweekend This parameter cause the applet to differentiate between week and weekend.

usdates This parameter causes the applet to expect U.S.-format dates in the form of mm/dd/yy instead of dd/mm/yy.

memory This parameter is used for dynamic data sources. It causes the applet to only retain the specified number of the most recent data points......

Table of Contents

Preface    vii
acknowledgments    ix
introduction    xi
 1 Introduction To Java     1
 2 Using Java Applets With Style   19
 3 Changing The Way Text Is Displayed   27
 4 Ticker Tape Type Text Displays   93
 5 Lines, Buttons, Bullets, and Counters With Java                               125
 6 Date And Time Applets 166
 7 Working With Links And EMail 187
 8 Working With Images And Animation 205
 9 Kid's Stuff 235
10 Miscellaneous Applets 259
11 Major Applets 285
12 Channels 303
13     Setting Up Channels 329
index 354

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews