• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't see image

 
Mike Clare
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my applet:
import java.awt.*;
import java.applet.Applet;

public class PictureMe extends Applet {
private Image image;
public void init() {
image = getImage(getDocumentBase(), "thermometer");
}
public void paint (Graphics g) {
g.drawImage(image, 20, 20, 242, 351, this);
}
}
The image is in the folder with the .class file and the html file
yet all I get is a blank field.
I have tried putting the suffex .jpg too.
What am I doing wrong.
Mike
 
Marilyn de Queiroz
Sheriff
Posts: 9062
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If the name of your image file is thermometer.gif, then you should use
image = getImage(getDocumentBase(), "thermometer.gif");

If the name of your image file is thermometer.jpg, then you should use
image = getImage(getDocumentBase(), "thermometer.jpg");

Otherwise, it worked for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic