Share this Page URL

Chapter 19. Caffeinating Your Pages: Add... > Java: A Piping Hot Mug of Browser-Ba... - Pg. 221

Caffeinating Your Pages: Adding Java Applets 221 Java programs--or applets, as they're usually called--are written using the Java programming lan- guage developed by Sun Microsystems. Here are a few advantages that Java programs have over traditional software: · The programs are sent to your browser and are started "behind the scenes." You don't have to worry about installation, setup, or loading because your browser takes care of all that dirty work for you. · The programs are designed to work on just about any system. Whether you're running Windows, a Mac, or a Unix machine, Java programs run without complaint. · Java is secure. When people hear about Java, their first concern is that some pimple-faced programmer who has succumbed to the dark side of The Force will send them a Java virus. But Java has built-in safeguards to prevent such attacks. · Because you're always sent the latest and greatest version of the program when you access a site, you don't need to worry about upgrades and new releases. So what do you need to start sipping some of this Java stuff? All you really need is a web browser that knows what the heck to do with any Java applet that comes its way. The latest versions of most browsers are now Java-jolted. Netscape has been Java-aware since version 2.0, and Internet Ex- plorer has done Java since version 3.0. In other words, you shouldn't have any problems with Java applets, and most of the folks viewing your pages are able to work with whatever applets you purloin for your own use. (Having said that, let me backpedal a bit and mention that fresh installations of Internet Explorer 6 doesn't come with Java support installed. The first time Internet Explorer comes across an applet, it asks if you want to download Java. I suspect most people will say yes, but bear in mind that some people may opt to surf Java-free.) Java applets come in all shapes and sizes, from tiny animations to full-blown software packages: word processors, spreadsheets, real-time stock quotes and portfolio management, high-end games, and much more. However, even the simplest Java doohickeys are exciting in their own way. This Java jazz is such a radical departure from typical web content that interacting with even the humblest applet is a revelation. So, in that spirit, let's visit a few sites that boast some Java functionality. Words from the Web Java-based animations tend to be simple or downright cheesy, so the web has spawned various uncompli- mentary names for them, including dancing baloney and craplets . Our first example is a fun thing called the Random Sentence Generator, which I built my self. As you can see in Figure 19.1, you click the Generate a New Sentence button and the applet provides you with a new, random (and often hilarious) sentence. If you want to try this out for yourself, head for the following page: