@Override
		public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {

			String currentText = getText(0, getLength());
			String beforeOffset = currentText.substring(0, offs);
			String afterOffset = currentText.substring(offs, currentText.length());
			String proposedText = beforeOffset + str + afterOffset;
			int alignment = getValue(proposedText);
			if (alignment > 0) {
				super.insertString(offs, str, a);
				model.setAlignment(alignment);
			}

		}
Called before new user input is inserted into the entry text field.  The super
method is called if the input is accepted.
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchOptionsPanel.java