title: Graphics.drawImage doesn't draw in Java
body: <p>I am trying to draw images with g.drawImage(), However, it does not display on the screen. So can you please examine my code and tell me what the reason may be?    </p>
  
  <pre><code>private char enemyBoard[][] = new char[10][10]; 
  private Rectangle r[][] = new Rectangle[10][10];
  private int size;  
  Image img;
  public EnemyPanel()
  {
      size=Constant.rectSize;
      for(int i=0;i&lt;10;i++){
          for(int j=0;j&lt;10;j++){
              enemyBoard[i][j]='*'; //initialization type
              r[i][j]= new Rectangle(j*size+30,i*size+30, size, size);         
          }
      }
  
      img=Toolkit.getDefaultToolkit().createImage("/edu/iyte/ceng316/resource/kurukafa2.jpg";);
  
  }
  
  
    public void paintComponent(Graphics g){     
          super.paintComponent(g);
  
          for(int i=0;i&lt;10;i++){
              for(int j=0;j&lt;10;j++)
                      g.drawImage(img,(int)r[i][j].getX(),(int)r[i][j].getY(),null);                                                          
              }
          }        
    }
  </code></pre>