private void generateField() {

		field = new MinefieldCell[rows][cols];
		for (int i = 0; i < rows; i++)
			for (int j = 0; j < cols; j++)
				field[i][j] = new MinefieldCell();

		for (int i = 0; i < mines; i++) {

			int row = (int) (Math.random() * rows);
			int col = (int) (Math.random() * cols);

			while (field[row][col].hasMine()) {
				row = (int) (Math.random() * rows);
				col = (int) (Math.random() * cols);
			}

			field[row][col].setMine(true);

		}

		for (int i = 0; i < rows; i++)
			for (int j = 0; j < cols; j++)
				field[i][j].setAdjacentMines(countAdjacentMines(i, j));

	}