@Override public void layoutContainer(Container parent) {
		int cardOverflow = fieldCardComponents.size() % 4;
		int cardsPerSide = fieldCardComponents.size() / 4;
		boolean even = true;
		Dimension point = new Dimension();

		//calculates where to start drawing the the field cards
		if(cardOverflow != 0) {
			point.width = cardsPerSide * FieldCard.widthCard + FieldCard.heightCard;
			even = false;
		} else {
			point.width = (cardsPerSide - 1) * FieldCard.widthCard + FieldCard.heightCard;
		}
		point.height = point.width;

		int currentCardIndex = 0;
		for(int i = 0; i < 4; i++) {
			if(cardOverflow > 0) {
				for(int j = 0; j < (cardsPerSide + 1); j++, currentCardIndex++) {
					setBoundaries(i, j, point, currentCardIndex, FieldCard.widthCard, cardsPerSide + 1);
				}
			} else {
				for(int j = 0; j < cardsPerSide; j++, currentCardIndex++) {
					if(even) {
						setBoundaries(i, j, point, currentCardIndex, FieldCard.widthCard, cardsPerSide);
					} else {
						//calculates the width of the card when it is needed to stretch it
						int widthCard = (FieldCard.widthCard * cardsPerSide - 1) / (cardsPerSide - 1);
						setBoundaries(i, j, point, currentCardIndex, widthCard, cardsPerSide);
					}
				}
			}
			if(cardOverflow != 0) {
				cardOverflow--;
			}
		}
	}