// 1. inits searchField with selected text
 // 2. adds focus listener so that textselection gets painted
 //    even if the textcomponent has no focus
 protected void initSearch(ActionEvent ae) {
   super.initSearch(ae);
   JTextComponent textComp = (JTextComponent) ae.getSource();
   String selectedText = textComp.getSelectedText();
   if (selectedText != null) searchField.setText(selectedText);
   searchField.removeFocusListener(this);
   searchField.addFocusListener(this);
 }