Images go away after minerals = 0
<p>In my program you can place pictures on the applet if you have the required minerals</p>

<p>you start with 400 and each one is 100 minerals so you place 3 and then on the 4th it will delete all the others</p>

<pre><code>public int Minerals

    //Pylons
    int xCoord[];
    int yCoord[];
    int numSquare;
    boolean firstPaint;

public void init()
    {   

        Minerals = 400;

        pylon = getImage(getDocumentBase(),"image/pylon.png");
    //pylons
        xCoord = new int[100];
        yCoord = new int[100];
        numSquare = 0;
        firstPaint = true;
}

public void paint(Grapics g)
{


            pylons(g);
}

    public void pylons(Graphics g)
    {
        //Building the pylons
        if(Minerals &gt;= 100)
        {

            for (int k = 0; k &lt; numSquare; k++)
            {
                    g.drawImage(pylon,xCoord[k],yCoord[k],85,85,this);
                    //Makes cursor normal.
                    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            }

        }

        //Checks if buildPylon is 1 if so it will draw the infoScreen and then set the cursor to pylon
        if(buildPylon == 1)
        {
            g.drawImage(pylon,510,820,100,100,this);
            //Use the custom cursor  
            setCursor(cursor);  
        }
    }

    private void handlePylonPlacement()
    {
        //This takes away 100 minerals and will add 9 population and make buildPylon 0 again
        if(decrementMinerals(100))
            addPopMax(9);
            buildPylon = 0;

    } 

    private boolean decrementMinerals(int amount)
    { 
        //This Is where it takes away the minerals
        if(Minerals - amount &gt;= 0) // prevent situation where you go into negative minerals
        {
             Minerals -= amount;
             return true;
        }
        else
             return false;
    }

    private void addPopMax(int amount)
    {
        //Add the population (9)
        if(popMax + amount &lt;= 72) // restrict addition to pop-max to a sane upper bound
             popMax += amount;
    }


public boolean mouseDown(Event e, int x, int y) {
        //Makes the ints xCoord2 to equal x and same for the other
        xCoord2 = x;
        yCoord2 = y;
        repaint();

        if (numClicks == 10) {//Title screen        
            numClicks++;
            repaint();
        }

    //Checks to see if buildPylon == 1 then builds the pylon if its in the correct place.

    if(buildPylon == 1)
    {
        if(x &gt; 1 &amp;&amp; x &lt; 1275 &amp;&amp; y &gt; 711 &amp;&amp; y &lt; 948) // Checks to see if the person clicked in this area
        {}
        else if(x &gt; 378 &amp;&amp; x &lt; 876 &amp;&amp; y &lt; 568 &amp;&amp; y &lt; 705) // Checks to see if the person clicked in this area
            {}else if (Minerals &gt;= 100) 
            {
            xCoord[numSquare] = x;
            yCoord[numSquare] = y;
            numSquare++;
            handlePylonPlacement(); // call your new handler
            repaint();
             }  
        }



        return true;
    } 
</code></pre>

<p>Instead of it deleting them i want the pylons to stay painted on the screen... any help?</p>
