This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Images in applets

 
Ranu Kundu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to include images in applets???
I have tried this:


Image image; public void init() {
image = getImage(getDocumentBase(), "http://hostname/image.gif");
}
public void paint(Graphics g) {
g.drawImage(image, 0, 0, this);
}

But nothing is showing in applet.Why?
 
Norm Radder
Ranch Hand
Posts: 728
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You seem to be passing two URLs to the getImage() method.
Read the API doc to see what the second arg should be.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic