my dog learned polymorphism*
The moose likes Beginning Java and the fly likes How can I load a gif and draw something on it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How can I load a gif and draw something on it?" Watch "How can I load a gif and draw something on it?" New topic
Author

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

fabio gomes
Greenhorn

Joined: Jul 02, 2001
Posts: 1
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

Joined: Jul 04, 2001
Posts: 3
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

Joined: Apr 06, 2001
Posts: 371
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can I load a gif and draw something on it?