import java.applet.*; import java.awt.*; import java.net.*; public class OldRevolve extends Applet implements Runnable { String[] pageTitle = new String[6]; URL[] pageLink = new URL[6]; int current = 0; Thread runner; public void init() { Color background = new Color(255, 255, 204); setBackground(background); pageTitle[0] = "Sun's Java site"; pageLink[0] = getURL("http://java.sun.com"); pageTitle[1] = "Java News"; pageLink[1] = getURL("http://www.intelligence.com/java/"); pageTitle[2] = "JavaWorld"; pageLink[2] = getURL("http://www.javaworld.com"); pageTitle[3] = "Java 1.2 in 24 Hours"; pageLink[3] = getURL("http://www.prefect.com/java24"); pageTitle[4] = "Macmillan Computer Publishing"; pageLink[4] = getURL("http://www.mcp.com"); pageTitle[5] = "Java Applet Rating Service"; pageLink[5] = getURL("http://www.jars.com"); Button goButton = new Button("Go"); add(goButton); } URL getURL(String urlText) { URL pageURL = null; try { pageURL = new URL(getDocumentBase(), urlText); } catch (MalformedURLException m) { } return pageURL; } public void paint(Graphics screen) { screen.drawString(pageTitle[current], 5, 60); screen.drawString("" + pageLink[current], 5, 80); } public void start() { if (runner == null) { runner = new Thread(this); runner.start(); } } public void run() { Thread thisThread = Thread.currentThread(); while (runner == thisThread) { repaint(); current++; if (current > 5) current = 0; try { Thread.sleep(10000); } catch (InterruptedException e) { } } } public void stop() { if (runner != null) { runner = null; } } public boolean action(Event event, Object object) { if (runner != null) { runner = null; } AppletContext browser = getAppletContext(); if (pageLink[current] != null) browser.showDocument(pageLink[current]); return true; } }