public PascalTriangleComponent(int rows){
    	totalRows = rows;
    	numbersInPascalTriangle = new int[rows*(rows+1)/2];
    	numbersInPascalTriangle[0]=1;
    	
    	//if there's only one row, we're done
    	if (rows==1) return;

    	numbersInPascalTriangle[1]=1;
    	numbersInPascalTriangle[2]=1;
    	int currentRow = 2;
    	int currentColumn = 0;
    	for(int i = 3; i < numbersInPascalTriangle.length; i++){
			int startPrevRow = ((currentRow-1)*(currentRow))/2;
			int leftParent = currentColumn>0? numbersInPascalTriangle[startPrevRow + currentColumn-1]:0;
			int rightParent = currentColumn<(currentRow) ? numbersInPascalTriangle[startPrevRow + currentColumn]:0;
			numbersInPascalTriangle[i] = leftParent+rightParent;

    		currentColumn++;
    		if(currentColumn>currentRow){
    			currentColumn = 0;
    			currentRow++;
    		}
    	}
    }