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", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access