import java.awt.Graphics; import java.awt.Image; import java.awt.Color; import java.net.URL; import java.lang.String; public class HighLightImage extends java.applet.Applet { boolean overimage=false; Image imagenormal; Image imagehighlight; URL highlightlink; public void init() { setBackground( Color.white ); imagenormal = getImage( getDocumentBase(), getParameter( "image" ) ); imagehighlight = getImage( getDocumentBase(), getParameter( "highlighted" ) ); try { highlightlink = new URL( getDocumentBase(), getParameter( "url" ) ); } catch ( java.net.MalformedURLException e ) {} } public boolean mouseEnter( java.awt.Event evt, int x, int y ) { overimage=true; showStatus( highlightlink.toString() ); repaint(); return true; } public boolean mouseExit( java.awt.Event evt, int x, int y ) { overimage=false; showStatus( "" ); repaint(); return true; } public boolean mouseUp( java.awt.Event evt, int x, int y ) { getAppletContext().showDocument( highlightlink ); return true; } public final synchronized void update(Graphics theG) { paint( theG ); } public void paint( Graphics g ) { if ( overimage ) { g.drawImage( imagehighlight, 0, 0, Color.white, this ); } else { g.drawImage( imagenormal, 0, 0, Color.white, this ); } } public String getAppletInfo() { return "HighLightImage v. 1.0\nVery simple image highlight applet\nAuthor: Edwin Martin"; } }