title: Java Image Drawing
body: <p>I'm in the process of making a simple 2-D game, however I am having trouble drawing images. Below are a few classes that are relevant to the problem</p>
  
  <pre><code>private Vector&lt;Bullet&gt; ammo = new Vector&lt;Bullet&gt;(100);
  
  public class Bullet{
      Image img;
      int x, y, speed;
      boolean show;
      Bullet(Image img,int x, int y, int speed, boolean show){
          this.x = x;
          this.y = y;
          this.speed = speed;
          this.img = img;
          this.show = show;
      }
      public void draw(ImageObserver obs) {
          if(show)
              g2.drawImage(img, this.x, this.y, obs);
      }
      public void update(){
          this.y -= 1;
      }
  }
  
  public class Movement{
      ....
  
      Movement(....){
          .....
      }
  
      public void fly(){
          ......
  
          ammo.add(new Bullet(bullet1, m.x, m.y, 7, true));
     }
  
  
  
  public class MyPlane {
  
      KeyControl key;
      Movement flight;
      Image img;
      int x, y, speed, move = 0;
      int boom;
      ...
  }
  
  
  public void drawDemo() {   
      ...        
          for(Bullet bullets: ammo)
              bullets.update();
      ...
          for(Bullet bullets: ammo)
              bullets.draw(this);
      }
  }
  </code></pre>
  
  <p>When I call bullets.draw(this) nothing actually is drawn on the screen. I know however that the ammo vector does contain the correct information, such as the x coordinate, y coordinate... I'm using Graphics 2-D by the way. Any help and or suggestions would be greatly appreciated thanks.</p>
  
  <pre><code> public void paint(Graphics g) {
      if(bimg == null) {
          Dimension windowSize = getSize();
          bimg = (BufferedImage) createImage(windowSize.width, 
                  windowSize.height);
          g2 = bimg.createGraphics();
      }
      drawDemo();
      g.drawImage(bimg, 0, 0, this);
  }
  </code></pre>