Previous Section  < Day Day Up >  Next Section

Watching the Skies at NASA

The first afternoon stop on the Java tour will be a trip to NASA, the National Aeronautics and Space Administration, a U.S. government agency that makes extensive use of Java applets. One of the most popular is J-Track, an applet that helps skywatchers keep an eye out for orbiting satellites. Load it in your browser at

J-Track superimposes the current location and path of satellites over a map of the world, shading the planet to show day and night for those of us who don't look out the window.

More than 100 different satellites can be added or dropped from view. The J-Track applet running in Figure 3.4 provides a glimpse of how crowded the skies have become with all of the scientific, military, and commercial craft circling the globe. With so many identified flying objects, people looking out for UFOs really have their work cut out for them.

Figure 3.4. NASA's J-Track applet monitors the location and path of orbiting satellites, a boon to metal birdwatchers.

The J-Track applet redraws the position of each tracked satellite as it runs, providing each craft's current latitude and longitude. This kind of real-time update is relatively easy to do because the Java language is multithreaded. Multithreading is a way for the computer to do more than one thing at the same time. One part of a program takes care of one task, another part takes care of a different task, and the two parts can pay no attention to each other. Each part of a program in this example is called a thread.

In a program such as J-Track, each satellite could run in its own thread. If you use an operating system such as Microsoft Windows XP, you're using a type of this behavior when you run more than one program at the same time. If you're at work and you play Texas Hold 'em poker in one window while running a company sales report in another window and making a long-distance call to a friend, congratulate yourself—you're multithreading!

    Previous Section  < Day Day Up >  Next Section