@Override
			public void insertString(int offs, String str, AttributeSet a)
					throws BadLocationException {
				if (str == null) {
					return;
				}

				String text = textField.getText();
				if (text.length() + str.length() > MAX_SIZE) {
					int nTooMany = text.length() + str.length() - MAX_SIZE;
					int len = str.length() - nTooMany;
					str = str.substring(0, len);
				}
				super.insertString(offs, str, a);
			}
@see javax.swing.text.Document#insertString(int, java.lang.String,
     javax.swing.text.AttributeSet)
Ghidra/Framework/Docking/src/main/java/docking/widgets/dialogs/InputDialog.java