Displaying Revolving Links

You’re now ready to create the program and test it. Create a new empty Java file named LinkRotator and type in the text from Listing 19.2.

Listing 19.2. The Full Text of LinkRotator.java

 1: import java.applet.*; 2: import java.awt.*; 3: import java.awt.event.*; 4: import javax.swing.*; 5: import java.net.*; 6: 7: public class LinkRotator extends JApplet 8:     implements Runnable, ActionListener { 9:10:     String[] pageTitle = new String[6];11:     URL[] pageLink = new URL[6];12:     Color butterscotch = new Color(255, 204, 158);13:     int current = 0;14:     Thread runner;15:16:     public void init() {17:         pageTitle = new String[] {18:             "Sun's Java site",19:             "Cafe au Lait",20:             "JavaWorld", ...

Get Sams Teach Yourself Java™ in 24 Hours, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.