Skip to content

Commit

Permalink
ToolBar: fixed endless loop if button in Toolbar has focus and is mad…
Browse files Browse the repository at this point in the history
…e invisible (issue #884)
  • Loading branch information
DevCharly committed Sep 29, 2024
1 parent a6ecb0e commit 4e6f538
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ FlatLaf Change Log
using custom component that overrides `Component.contains(int x, int y)` and
invokes `SwingUtilities.convertPoint()` (or similar) from the overridden
method. (issue #878)
- ToolBar: Fixed endless loop if button in Toolbar has focus and is made
invisible. (issue #884)


## 3.5.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,11 @@ public Component getLastComponent( Container aContainer ) {

private Component getRecentComponent( Container aContainer, boolean first ) {
// if moving focus into the toolbar, focus recently focused toolbar button
if( focusedCompIndex >= 0 && focusedCompIndex < toolBar.getComponentCount() )
return toolBar.getComponent( focusedCompIndex );
if( focusedCompIndex >= 0 && focusedCompIndex < toolBar.getComponentCount() ) {
Component c = toolBar.getComponent( focusedCompIndex );
if( accept( c ) )
return c;
}

return first
? super.getFirstComponent( aContainer )
Expand Down

0 comments on commit 4e6f538

Please sign in to comment.