@Override
			public void insertString(int offs, String str, AttributeSet a)
					throws BadLocationException {
				if (str == null) {
					return;
				}
				int oldLength = getLength();
				int max = getColumns();
				if (oldLength + str.length() > max) {
					toolkit.beep();
					message("Exceeded " + max + " characters.");
					str = str.substring(0, max - oldLength);
				}
				super.insertString(offs, str, a);
			}
Similar to {@link NumericUtilities#parseLong(String)}, but we return 0 if the string
is null, empty, or looks like a partially entered value (such as "-", "0x", etc)

@param s the string to parse
@return the parsed {@code long} value, or 0 if the string is null, empty, or looks
  like a partially entered value (such as "-", "0x", etc)
@throws NumberFormatException if the string does not represent a valid {@code long} 
  value
Ghidra/Framework/Docking/src/main/java/docking/widgets/textfield/GValidatedTextField.java