Split-Personality Applets
By Al Williams
Teaching classes and consulting, I travel a lot. Because of this, I'm becoming quite fond of Internet-based services. I check my mail on Hotmail. I keep my calendar on Yahoo. I even share files with clients using a couple of online services -- FreeDrive and the very cool involv. These are great, because I can access them no matter where I am. Well, almost. (see "
Online")
I do a lot of work on airplanes. Yes, there are phones on planes now, but I really don't want to pay $3 a minute for a slow Internet connection. Other times I'll be in a classroom that doesn't have a connection (although that's getting less common all the time). What can I do then? It would be nice if I could have Web-enabled applications that could also run without a Web connection.
With that in mind, I decided to create a simple applet that displays a phone book of names and phone numbers from a server. Although the program runs as an applet, you can download the exact same class file and use it as an application. When you run it on the local machine, the program reads its data from a local file (which, of course, you can download from the server). Applets can't access the local file system, so they read the same data from the server.
The Core Applet
The basic applet is straightforward (the PhBook applet is available electronically; see "
|