title: For loop will not work
body: <p>I have looked at numerous examples of for loops and I cannot figure out why mine won't work.  In my program there is a component, viewer and a building class.  I have it set so when you create a new building in the component, you enter x-pos, y-pos, and # of levels.  I want to run the for loop to create each level, but it will not work.  Please help and thanks.</p>
  
  <pre><code>import java.awt.Color;
  import java.awt.Graphics;
  import java.awt.Graphics2D;
  import java.awt.Rectangle;
  
  
  public class Building
  {
      /**number of levels the building has*/
      private int levels;
      private int xLeft;
      private int yTop;
      private int lvls;
  
      /**
       * Constructor for objects of class Building
       * 
       * @param x x-Coordinate
       * 
       * @param y y-Coordinate
       * 
       * @param levels The number of thevels the building will have
       */
      public Building(int x, int y, int lvls)
      {
          xLeft = x;
          yTop = y;
          levels = lvls;
  
      }
  
      /**
       * Draws the building
       * 
       * @param  g2   graphics contex
       */
      public void draw(Graphics2D g2)
      {
        /**creates one building level*/
        Rectangle body = new Rectangle(xLeft/*X*/, yTop/*Y*/, 100/*Width*/,         100/*Height*/);
        /**creates window inside of building level*/
        Rectangle window = new Rectangle(xLeft+25, yTop+25, 50, 50);
        g2.setColor(Color.DARK_GRAY);
        g2.fill(body);
        g2.setColor(Color.ORANGE);
        g2.fill(window); 
  
        /**Creates (levels) number of levels*/
        for(int i = 1; i&lt;=levels; i++)
        {
           /**Adds 100 to y value of body*/
           body.setLocation(xLeft, yTop-100);
           g2.setColor(Color.DARK_GRAY);
           g2.fill(body);
           window.setLocation(xLeft+25, yTop-75);
           g2.setColor(Color.ORANGE);
           g2.fill(window);   
          }
  
  
      }
  
  }
  </code></pre>