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 f1186801..f906c9fe 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 @@ -93,6 +93,8 @@ class FlatFindReplaceBar String selectedText = textArea.getSelectedText(); if( !StringUtils.isEmpty( selectedText ) && selectedText.indexOf( '\n' ) < 0 ) findField.setText( selectedText ); + else + findField.selectAll(); // if showing bar, highlight matches in editor // (not invoking this from addNotify() because this would break the slide-in animation) diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java index 47a13b33..d09b4c4f 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java @@ -185,7 +185,12 @@ class FlatThemeEditorPane } try { + int selectionStart = textArea.getSelectionStart(); + int selectionEnd = textArea.getSelectionEnd(); + textArea.reload(); + + textArea.select( selectionStart, selectionEnd ); } catch( IOException ex ) { JOptionPane.showMessageDialog( this, "Failed to reload '" + textArea.getFileName() + "'\n\nReason: " + ex.getMessage(), diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/light.xml b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/light.xml index 22d780ec..1c548fda 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/light.xml +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/light.xml @@ -62,7 +62,7 @@