Theme Editor:

- fixed broken (mouse-wheel) scrolling caused by the additional JPanel
- fixed broken slide-in animation of "find bar"
This commit is contained in:
Karl Tauber
2020-12-31 22:29:09 +01:00
parent d70eca9774
commit 2f47466f3b
2 changed files with 6 additions and 18 deletions

View File

@@ -84,23 +84,21 @@ class FlatFindReplaceBar
@Override @Override
public boolean requestFocusInWindow() { public boolean requestFocusInWindow() {
// invoked from CollapsibleSectionPanel // invoked from CollapsibleSectionPanel
return findField.requestFocusInWindow();
}
@Override
public void addNotify() {
super.addNotify();
// if showing bar, highlight matches in editor // if showing bar, highlight matches in editor
// (not invoking this from addNotify() because this would break the slide-in animation)
markAll(); markAll();
return findField.requestFocusInWindow();
} }
@Override @Override
public void removeNotify() { public void removeNotify() {
super.removeNotify(); super.removeNotify();
// if hiding bar, clear all highlighted matches in editor // if hiding bar, clear all highlighted matches in editor and focus it
SearchEngine.markAll( textArea, new SearchContext() ); SearchEngine.markAll( textArea, new SearchContext() );
textArea.requestFocusInWindow();
} }
private void findNext() { private void findNext() {

View File

@@ -109,18 +109,8 @@ class FlatThemeEditorPane
// create overlay layer // create overlay layer
JLayer<FlatSyntaxTextArea> overlay = new JLayer<>( textArea, new FlatThemeEditorOverlay() ); JLayer<FlatSyntaxTextArea> overlay = new JLayer<>( textArea, new FlatThemeEditorOverlay() );
// create view panel that transfers focus to editor when hiding find/replace bar
JPanel viewPanel = new JPanel( new BorderLayout() ) {
@Override
public boolean requestFocusInWindow() {
// invoked from CollapsibleSectionPanel
return textArea.requestFocusInWindow();
}
};
viewPanel.add( overlay, BorderLayout.CENTER );
// create scroll pane // create scroll pane
scrollPane = new RTextScrollPane( viewPanel ); scrollPane = new RTextScrollPane( overlay );
scrollPane.setBorder( null ); scrollPane.setBorder( null );
scrollPane.setLineNumbersEnabled( true ); scrollPane.setLineNumbersEnabled( true );