// Motate Applet // Oct. 10th, 1997 import java.applet.*; import java.awt.*; import java.net.*; public class Motate extends Applet { Image image; URL url; //---------------------------------------------------------------- public void init() { int no = Integer.parseInt(getParameter("n")); no = RandomInteger(no); String sFileName = getParameter("image"+no); image = getImage(getCodeBase(), sFileName); String sURL = getParameter("url"+no); try { url = new URL(sURL); } catch (Exception e) { url = new URL("http://www.blazonry.com/"); } } //---------------------------------------------------------------- public int RandomInteger(int c) { int n; double d = Math.random(); // 0.0 to 1.0 d = d * 100; n = (int)(d % c) + 1; // 1 to c (max. 100) return n; } //-------------------------------------------------------------------------- public void paint(Graphics g) { g.drawImage(image, 0, 0, this); } //---------------------------------------------------------------- public boolean mouseDown(Event evt, int x, int y) { // Open URL when Applet is clicked getAppletContext().showDocument(url); return true; } //---------------------------------------------------------------- public boolean mouseEnter(Event evt, int x, int y) { // Show link in status line when mouse is over the Applet String sURL = url.toString(); showStatus(sURL); return true; } } // fini