public int getCol(int row, int x) {
		if (x < 0) {
			return 0;
		}
		if (row < 0) {
			row = 0;
		}
		else if (row >= model.getNumRows()) {
			return 0;
		}

		int xpos = 0;
		FieldFactory[] fields = model.getFactorys(row);
		for (int i = 0; i < fields.length; i++) {
			xpos += fields[i].getWidth();
			if (x < xpos) {
				return i;
			}
		}
		return fields.length;
	}
Returns the index of the field on the given row containing the give x position.
@param row the row on which to find the index of the field containing the x coordinate.
@param x the horizontal coordinate (in pixels) 
@return the column
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/format/FieldHeaderComp.java