diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java index 9910c28f..bad54386 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatFindReplaceBar.java @@ -72,6 +72,22 @@ class FlatFindReplaceBar return findField.requestFocusInWindow(); } + @Override + public void addNotify() { + super.addNotify(); + + // if showing bar, highlight matches in editor + find(); + } + + @Override + public void removeNotify() { + super.removeNotify(); + + // if hiding bar, clear all highlighted matches in editor + SearchEngine.markAll( textArea, new SearchContext() ); + } + private void findNext() { context.setSearchForward( true ); find();