/* 
  This applet will load an image for you. If the user clicks
  on the image it will take you to a URL that you specify.
  (This applet loads pictures in their actual size in pixels.
  use another program to resize the graphic.)
Applet tags:
  <applet code=display_one_image.class height = 70 width = 340 >
   <PARAM name="fileName" value="filename.gif">  // could be a gif or jpg or any image
   <PARAM placeName="http://whereyouwantogo.com"> // a legal url
 </applet>
*/
   import java.net.*;
   import java.awt.*;
   import java.applet.AppletContext;
   import java.awt.event.*;
   import javax.swing.*;

    public class display_one_image extends JApplet implements MouseListener
   {
      private Image anyGraphic;
      int width,height;
   	  
       public void init()
      {
         do{//be sure the picture actually loads.
            anyGraphic = getImage(getDocumentBase(),getParameter("fileName"));
            width=anyGraphic.getWidth(this);
            height=anyGraphic.getHeight(this);
         }while(width<0);
         //make the pictue mouseable.
         addMouseListener(this);
      }
      
       public void paint(Graphics gr)
      {    
         gr.drawImage(anyGraphic, 1, 1, width, height, this);
      }
     
     // This is the mouselistener 
       public void mouseClicked(MouseEvent e){}
       public void mouseReleased(MouseEvent e){}
       public void mouseEntered(MouseEvent e){}
       public void mouseExited(MouseEvent e){}
       public void mousePressed(MouseEvent e)
      {
         try{ 
            URL target = new URL(getParameter("placeName")); 
            AppletContext browser = getAppletContext();
            browser.showDocument(target);
         }
             catch(MalformedURLException xe){}//would not know how to fix it.
      }
   
   }