private void formatCompositeText(Composite comp) {
		formatSourceArchive(comp);
		formatPath(comp);
		formatAlignment(comp);
		insertString(comp.getDisplayName(), nameAttrs);
		insertString(" { \n", contentAttrs);

		boolean showComponentOffset = false;

		DataTypeComponent[] components = comp.getDefinedComponents();
		if (comp instanceof Structure) {
			showComponentOffset = !comp.isPackingEnabled();
		}

		int offsetLength = showComponentOffset ? Integer.toHexString(comp.getLength()).length() : 0;
		int maxDtNameLength = 10;
		int maxFieldNameLength = 1;
		for (DataTypeComponent component : components) {
			maxDtNameLength = max(getDataTypeName(component), maxDtNameLength);
			maxFieldNameLength = max(component.getFieldName(), maxFieldNameLength);
		}

		for (DataTypeComponent component : components) {
			renderComponent(component, maxDtNameLength, maxFieldNameLength, offsetLength);
		}

		insertString("}\n\n", contentAttrs);
		insertAlignment(comp);
		insertLength(comp);
	}
Panel to show the contents of a Data Type.
Ghidra/Features/Base/src/main/java/ghidra/app/merge/datatypes/DataTypePanel.java