O'Reilly logo

Sams Teach Yourself Java™ in 24 Hours, Sixth Edition by Rogers Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required