public void setGlobalCaret(int caret) throws BadLocationException {
			int globalCaret = caret;

			for (int i = 0; i < fieldStates.size(); i++) {
				FieldState fs = fieldStates.get(i);

				if (i > 0) {
					caret -= linkedFields.get(i - 1).sep.length();
				}
				if (caret <= 0) {
					whichFocus = i;
					fs.caret = 0;
					return;
				}
				if (caret <= fs.text.length()) {
					whichFocus = i;
					fs.caret = caret;
					return;
				}
				caret -= fs.text.length();
			}
			throw new BadLocationException("caret position (" + globalCaret + ") too large",
				globalCaret);
		}
Set the composite caret location

@param caret the new caret location
@throws BadLocationException if the location exceeds the text length
Ghidra/Framework/Docking/src/main/java/docking/widgets/textfield/TextFieldLinker.java