Skip to content

Commit

Permalink
Merge PR #790: Table header background is never restored after hover …
Browse files Browse the repository at this point in the history
…when the renderer background is null
  • Loading branch information
DevCharly committed Jan 10, 2024
2 parents fa53e90 + 9f17a5b commit 6fdc56f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ FlatLaf Change Log
- Fixed background of `boolean` columns when using alternating row colors.
(issue #780)
- Fixed border arc of components in complex table cell editors. (issue #786)
- TableHeader: No longer temporary replace header cell renderer while painting.
This avoids a `StackOverflowError` in case that custom renderer does this too.
(see [NetBeans issue #6835](https://github.com/apache/netbeans/issues/6835))
This also improves compatibility with custom table header implementations.
- TableHeader:
- No longer temporary replace header cell renderer while painting. This avoids
a `StackOverflowError` in case that custom renderer does this too. (see
[NetBeans issue #6835](https://github.com/apache/netbeans/issues/6835)) This
also improves compatibility with custom table header implementations.
- Header cell renderer background/foreground colors were not restored after
hover if renderer uses `null` for background/foreground. (PR #790)
- TabbedPane:
- Avoid unnecessary repainting whole tabbed pane content area when layouting
leading/trailing components.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public void paintComponent( Graphics g, Component c, Container p, int x, int y,
JLabel l = (JLabel) c;
Color oldBackground = null;
Color oldForeground = null;
Boolean oldOpaque = null;
boolean oldOpaque = false;
Icon oldIcon = null;
int oldHorizontalTextPosition = -1;

Expand Down Expand Up @@ -415,12 +415,12 @@ public void paintComponent( Graphics g, Component c, Container p, int x, int y,
}

// restore modified renderer component properties
if( oldBackground != null )
if( background != null ) {
l.setBackground( oldBackground );
if( oldForeground != null )
l.setForeground( oldForeground );
if( oldOpaque != null )
l.setOpaque( oldOpaque );
}
if( foreground != null )
l.setForeground( oldForeground );
if( oldIcon != null )
l.setIcon( oldIcon );
if( oldHorizontalTextPosition >= 0 )
Expand Down

0 comments on commit 6fdc56f

Please sign in to comment.