@Override
	public void handle(KeyEvent event) {
		if (keys.getFind().match(event)) {
			// Show if not visible
			if (!bar.isVisible())
				bar.show();

			// Update input text based on current selection
			if (editor != null) {
				String selectedText = editor.getCodeArea().getSelectedText();
				if (!selectedText.isEmpty()) bar.getSearchTextProperty().setValue(selectedText);
			}

			// Grab focus
			bar.requestSearchFocus();
			bar.hideReplace();
		} else if (keys.getReplace().match(event)) {
			// Show if not visible
			if (!bar.isVisible())
				bar.show();

			// Update input text based on current selection
			if (editor != null) {
				String selectedText = editor.getCodeArea().getSelectedText();
				if (!selectedText.isEmpty()) bar.getSearchTextProperty().setValue(selectedText);
			}

			// Grab focus
			bar.showReplace();
			bar.replaceInput.requestFocus();
		}
	}
Search bar component, with layout and functionality inspired from IntelliJ's.

@author Matt Coley
recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/search/SearchBar.java