Some Light Relief—Think Big (and Small)

One early Java technology was applets—a Java program that runs in a browser. Someone who sets up a website can serve up executable Java programs referenced from HTML pages. When a user browses such a page, the Java code is downloaded to his or her system, along with the HTML text and images. A JVM inside the browser (safely and securely) executes the applet on the user's system.

You write an applet by extending the class javax.swing.JApplet, supplying your own child versions of some of the methods in the base class. At one time applets were very popular on the Internet, and they are still widely used for some applications on company intranets. They are also widely used at some educational sites.

Applets were wounded in the “browser wars” of the late 1990s. Microsoft crushed all competition in web browsers by bundling the Internet Explorer application, and paying off large ISPs to use Explorer. Eventually Netscape went out of business, and then people had to download complicated browser plug-ins to use applets. Many decided it was more trouble than it was worth. Pulling this kind of stunt is illegal when you're a monopoly. Microsoft settled out of court by paying $750 million to Netscape's owner AOL. But Netscape was still out of business, and there was still no competition in the browser market, and there was still no native support for applets.

People write applets to do all kinds of things, usually focused on a graphical and/or dynamic presentation of data from the server. There's one particularly good applet which you can easily find on the web. Known as the “Powers of 10” demo, it was written by Matthew J. Parry-Hill, Christopher A. Burdett, and Michael Davidson of the National High Magnetic Field Laboratory at Florida State University. The applet is based on the book "Cosmic View: The Universe in 40 Jumps" written by brilliant Dutch engineer and educator, Kees Boeke. Figure 9-2 shows a screen shot of the Powers of 10 applet.

Figure 9-2. Powers of 10 interactive Java-based tutorial at http://micro.magnet.fsu.edu/primer/java/scienceopticsu/powersof10/index.html

image

The Powers of 10 applet presents a series of images, starting with the galaxy at 10 million light years from earth. Each image brings you, the observer, 10 times closer to earth. After about 15 such zoom-ins, there is a recognizable planet earth in the picture. Further zooms bring you to the Western hemisphere, the state of Florida, to a tree by the National High Magnetic Field Laboratory. You then zoom into a leaf, a leaf cell, DNA, and sub-atomic protoplasmic primordial globules.

Powers of 10 is an interactive Java-based tutorial on comparative sizes, fun as well as educational. Michael used a couple of interesting techniques to speed up performance. Only a couple of the images are downloaded before the applet starts. The rest are brought from the server as the applet is running, so the user does not have to wait. The “zoom in” effect on an image is done by re-drawing the images at different sizes rather than inefficiently using a succession of different-sized images. The applet is at http://micro.magnet.fsu.edu/primer/java/scienceopticsu/powersof10/index.html and it has been run by more than 14 million people in the last six years. Check it out; it's shown in Figure 9-2.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.82.154