+ private static final int MIN_WIDTH = 350;
+
+ private static final int MIN_HEIGHT = 120;
+
+ private static final int MY_HEIGHT = 150;
+
+ private static final int MY_WIDTH = 400;
+
+ private AlignViewportI av;
+
+ private AlignmentPanel ap;
+
+ private JInternalFrame frame;
+
+ /*
+ * Finder agent per viewport searched
+ */
+ private Map<AlignViewportI, FinderI> finders;
+
+ private SearchResultsI searchResults;
+
+ /**
+ * Constructor given an associated alignment panel. Constructs and displays an
+ * internal frame where the user can enter a search string.
+ *
+ * @param alignPanel
+ */
+ public Finder(AlignmentPanel alignPanel)
+ {
+ av = alignPanel.getAlignViewport();
+ ap = alignPanel;
+ finders = new HashMap<>();
+ frame = new JInternalFrame();
+ frame.setContentPane(this);
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ frame.addInternalFrameListener(
+ new InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosing(InternalFrameEvent e)
+ {
+ closeAction();
+ }
+ });
+ addEscapeHandler();
+
+ Desktop.addInternalFrame(frame, MessageManager.getString("label.find"),
+ MY_WIDTH, MY_HEIGHT);
+ frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
+ searchBox.requestFocus();
+ }
+
+ /**
+ * Add a handler for the Escape key when the window has focus
+ */
+ private void addEscapeHandler()
+ {
+ getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
+ .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Cancel");
+ getRootPane().getActionMap().put("Cancel", new AbstractAction()