@Override
	public ListingField getField(ProxyObj<?> proxy, int varWidth) {
		if (!enabled) {
			return null;
		}

		Object obj = proxy.getObject();
		if (!enabled || !(obj instanceof CodeUnit)) {
			return null;
		}
		CodeUnit cu = (CodeUnit) obj;

		byte[] bytes = null;
		double entropy = 0.0;
		try {
			bytes = new byte[256];
			int num = cu.getProgram().getMemory().getBytes(cu.getAddress(), bytes);
			if (num < bytes.length) {
				return null;
			}
			entropy = calcEntropy(bytes, 0, bytes.length);
			float[] hsbvals = Color.RGBtoHSB(255, 0, 0, null);
			Color color =
				Color.getHSBColor(hsbvals[0], hsbvals[1], (float) (hsbvals[1] * (entropy / 8.0)));
			String str = "" + (int) ((entropy / 8.0) * 100);
			AttributedString text = new AttributedString(str, color, getMetrics());

			FieldElement fieldElement = new TextFieldElement(text, 0, 0);
			return ListingTextField.createSingleLineTextField(this, proxy, fieldElement,
				startX + varWidth, width, hlProvider);
		}
		catch (MemoryAccessException e) {
			return null;
		}

	}
@see ghidra.app.util.viewer.field.FieldFactory#getField(ProxyObj, int)
Ghidra/Extensions/sample/src/main/java/ghidra/examples/EntropyFieldFactory.java