title: Images in Applet not showing in web page
body: <p>I am trying to display a JPEG image and a moving dot on a Java applet which I am using on a web based application. However, when I run the applet it works fine, but when I display the applet from the JSP page, I get the moving dot but not the JPEG image.</p>
  
  <p>Is there a specific folder where the JPEG needs to be?</p>
  
  <p>These are the 2 methods i use for drawing the picture and the moving dot on the screen.</p>
  
  <pre><code>public class mapplet extends Applet implements Runnable {
  
  int x_pos = 10;
  int y_pos = 100;
  int radius = 20;
  Image img, img2;
  Graphics gr;
  URL base;
  MediaTracker m;
  
  @Override
  public void init() {
  
          mt = new MediaTracker(this);
  
          try {
              //getDocumentbase gets the applet path.
             base = getCodeBase();
            img = getImage(base, "picture.jpg");
              m.addImage(img, 1);
              m.waitForAll();
          } catch (InterruptedException ex) {
              Logger.getLogger(movement.class.getName()).log(Level.SEVERE, null, ex);
         }
  
  public void paint (Graphics g) {
  
   g.drawImage(img, 0, 0, this);
  // set color
   g.setColor (Color.red);
  
  // paint a filled colored circle
  g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
  
  }
  </code></pre>
  
  <p>The code one below is the call from the jsp page</p>
  
  <pre><code>&lt;applet archive="mapplet.jar" code="myapplets/mapplet.class" width=350 height=200&gt;
  &lt;/applet&gt;
  </code></pre>
  
  <p>The jar file and the picture are in the same folder as the jsp page, and there is also a folder containing the contents of the class and image of the applet in the web section of the application. The applet loads fine however the picture doesn't display. I think it's not the code but the location of the picture that is causing a problem. </p>
  
  <p>Thanks</p>