From 1c08e98c1c2cd908c90cf117099a1f694e3152c1 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Thu, 31 Dec 2020 15:55:22 +0100 Subject: [PATCH] Theme Editor: show/hide highlighted matches when showing/hiding "find bar" --- .../flatlaf/themeeditor/FlatFindReplaceBar.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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();