private static int getNumberOfElementsPerLine(List<FieldElement> elements, int start,
			int width) {

		int currentWidth = 0;
		for (int i = start; i < elements.size(); i++) {
			FieldElement element = elements.get(i);
			currentWidth += element.getStringWidth();
			if (currentWidth > width) {
				int count = i - start;
				return Math.max(count, 1);
			}
		}
		return elements.size() - start;
	}
This constructor will create a text field that will render one line of text. If
<code>metrics.stringWidth(text) &gt; width</code>, then the text will be wrapped.
If <code>text</code> contains the highlight string, then it will be highlighted using the
highlight color.

@param elements the AttributedStrings to display
@param startX the x position to draw the string
@param width the max width allocated to this field
@param maxLines the max number of lines to display
@param hlFactory the highlight factory
Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/FlowLayoutTextField.java