fix: restore the renderer background after hover

The table header background is never restored after hover when the label renderer is opaque
This commit is contained in:
Dar
2024-01-09 16:58:21 +01:00
parent a9ea9daec3
commit 5630c161ea

View File

@@ -360,6 +360,9 @@ public class FlatTableHeaderUI
Icon oldIcon = null;
int oldHorizontalTextPosition = -1;
// needed when we have to restore the label background after hover and the renderer is opaque
boolean restoreBackground = false;
// hover and pressed background/foreground
TableColumn draggedColumn = header.getDraggedColumn();
Color background = null;
@@ -377,6 +380,7 @@ public class FlatTableHeaderUI
if( background != null ) {
oldBackground = l.getBackground();
oldOpaque = l.isOpaque();
restoreBackground = true;
l.setBackground( FlatUIUtils.deriveColor( background, header.getBackground() ) );
l.setOpaque( true );
}
@@ -415,7 +419,7 @@ public class FlatTableHeaderUI
}
// restore modified renderer component properties
if( oldBackground != null )
if( restoreBackground )
l.setBackground( oldBackground );
if( oldForeground != null )
l.setForeground( oldForeground );