Hello,
I need help on my AWT program. I have a map being displayed, and would like an image of a car (car.gif) to be displayed over the image of the map.
So my question is: How do I make this map a background image, and put the picture of the car right over it. I need my map loaded all the time, and the picture of the car will be reloaded many times over the same map, so a class method to load this map would be perfect. Any help, code, or suggestions would be great. Thanks so much!
Here is what I currently have for my map.
import java.awt.*;
import java.awt.event.*;
public class MyImage extends Panel {
private Image im = null;
Graphics g;
public void getMap(){
im = Toolkit.getDefaultToolkit().getImage("C:\\test_map.gif");
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(im,0);
try {
tracker.waitForID(0);
}catch (InterruptedException e){}
repaint();
}
public void paint(Graphics g){
this.g = g;
if (im != null) {
g.drawImage(im,0,0,this.getWidth(),this.getHeight(),this); //706,397
}
}