• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting Backgrounds  RSS feed

 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to set an image as the background of an applet? Please help.
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no simple way to do this. What you have to do is provide a paint method in the applet class and have it draw the image before it draws anything else. The main thing to watch out for is to check the image before you draw it - you don't want to be calling drawImage if the Image reference is null.
Bill
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other way to do this would be to override update() and draw the image in there, then call paint(). This would eliminate the flickering you'd get.
------------------
- Daniel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!