public void showDialog(boolean showReplace) { getReplaceLabel().setVisible(showReplace); getReplaceTextField().setVisible(showReplace); getReplaceButton().setVisible(showReplace); getReplaceAllButton().setVisible(showReplace); if (showReplace) { setTitle("Replace"); getRootPane().setDefaultButton(getReplaceButton()); getReplaceFindButton().setText("Find..."); getReplaceFindButton().setMnemonic('d'); getReplaceFindButton().setDisplayedMnemonicIndex(3); } else { setTitle("Find"); getRootPane().setDefaultButton(getFindNextButton()); getReplaceFindButton().setText("Replace..."); getReplaceFindButton().setMnemonic('R'); getReplaceFindButton().setDisplayedMnemonicIndex(0); } pack(); if (!initLoc && editor != null) { Rectangle bounds = editor.getBounds(); Dimension size = getSize(); setLocation( (int) (bounds.getX() + (bounds.getWidth() - size.getWidth()) / 2), (int) (bounds.getY() + (bounds.getHeight() - size.getHeight()) / 2)); initLoc = true; } // Bugfix [2664844] - Editor: Find (set cursor position) getFindTextField().requestFocus(); setVisible(true); }