@Override
		public void insertUpdate(DocumentEvent e) {
			JTextField textField = getTextField();
			String input = textField.getText();
			String match = matchHistory(input);
			if (match != null && match.length() > input.length()) {
				// Not allowed to modify textField while in the document listener call.
				Swing.runLater(() -> {
					textField.setText(match);
					textField.setSelectionStart(input.length());
					textField.setSelectionEnd(match.length());
				});
			}
		}
Listener to perform matching of items as the user types
Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java