Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I load a gif and draw something on it?

 
fabio gomes
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to load a gif and draw something over the image but I can't because the getGraphics doesn't work with getImage, it works only with createImage.
Can somebody help me?
 
jane stockdill
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always layer it so you have a frame and in the frame you place a panel - in the panel you draw the gif. Then also in the frame you have the other things that you want to draw. You will however nee to have a null layout in the frame so that you can place components on top of each other. This works for the work i'm dong where i have a gif in the background and then text boxes and labels on top of the image. Hope this might work for you.
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, you can load the Image through a MediaTracker instance, then create another Image using Frame's createImage(). Then draw the loaded Image UPON the Frame's Image using the new Image's Graphics object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic