@Override
	public void paint(Graphics g) {

		g.setColor(defaultButtonBgColor);
		int nRows = model.getNumRows();
		Dimension dim = getSize();
		g.fillRect(0, 0, dim.width, dim.height);
		paintBorder(g);
		FieldFactory selectedFactory = headerPanel.getSelectedFieldFactory();
		for (int i = 0; i < nRows; i++) {
			FieldFactory[] factorys = model.getFactorys(i);
			int nfields = factorys.length;
			int startX = 0;
			for (int j = 0; j < nfields; j++) {
				String name = factorys[j].getFieldText();
				int startY = i * rowHeight;
				int width = factorys[j].getWidth();
				int height = rowHeight;
				label.setText(name);
				label.setEnabled(factorys[j].isEnabled());
				if (factorys[j] == selectedFactory) {
					label.setBackground(ACTIVE_FIELD_BG_COLOR);
					label.setForeground(ACTIVE_FIELD_FG_COLOR);
				}
				else {
					label.setBackground(defaultButtonBgColor);
					label.setForeground(defaultButtonFgColor);
				}

				renderPane.paintComponent(g, label, this, startX, startY, width, height, true);

				startX += width;
			}
		}
		if (moving != null) {
			label.setText(moving.name);
			renderPane.paintComponent(g, label, this, moving.floatingX, moving.floatingY,
				moving.width, rowHeight, true);
		}

	}
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