public void addListeners() {

		getDocument().addDocumentListener(new DocumentListener() {

			@Override
			public void removeUpdate(DocumentEvent e) {
				validateField();
			}

			@Override
			public void insertUpdate(DocumentEvent e) {
				validateField();
			}

			@Override
			public void changedUpdate(DocumentEvent e) {
				// do nothing
			}
		});
	}
Key listener allows us to check field validity on every key typed
Ghidra/Framework/Docking/src/main/java/docking/widgets/textfield/HintTextField.java