/* * DualImageButtonApplet.java * * Copyright (C) 1996 Shaun Terry. All Rights Reserved. */ package spt.applets; import java.awt.Image; import java.awt.Event; import java.net.URL; import java.net.MalformedURLException; import java.applet.*; import spt.gui.ImagePanel; import spt.gui.AnimatedImageButton; /** * A button applet that displays one image when at rest and another * when the mouse is moved over it.

* Parameters *

 * IMGONENTER	URL	The image to show when the mouse is over the button (required)
 *
 * 
* Plus ImageButtonApplet and StdApplet parameters. * * @see spt.applets.StdApplet * @see spt.applets.ImageButtonApplet * * @author Shaun Terry */ public class DualImageButtonApplet extends ImageButtonApplet { AnimatedImageButton imgButton; public void init() { stdAppletInit(); URL img1=null, img2=null; try { img1 = paramParser.getURL("IMG"); img2 = paramParser.getURL("IMGONENTER"); } catch (MalformedURLException e) { System.err.println("Param(IMG1/2) Error: " + e); return; } String text = paramParser.getParameter("TEXT"); imgButton = new AnimatedImageButton(text); Image ip; ip = ImagePanel.loadImage(this, img1); imgButton.addImage(ip, 0); ip = ImagePanel.loadImage(this, img2); imgButton.addImage(ip, Integer.MAX_VALUE); imgButton.setRepeat(true); imgButton.setAnimateOnEnter(true); super.imgButton = imgButton; super.setParams(); imgButton.startAnimation(); add(imgButton); } /** Parameters */ public String[][] getParameterInfo() { String[][] info = { { "IMGONENTER", "URL", "The image when mouse enters" }, }; return mergeParameters(super.getParameterInfo(), info); } }