mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
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:
@@ -360,6 +360,9 @@ public class FlatTableHeaderUI
|
|||||||
Icon oldIcon = null;
|
Icon oldIcon = null;
|
||||||
int oldHorizontalTextPosition = -1;
|
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
|
// hover and pressed background/foreground
|
||||||
TableColumn draggedColumn = header.getDraggedColumn();
|
TableColumn draggedColumn = header.getDraggedColumn();
|
||||||
Color background = null;
|
Color background = null;
|
||||||
@@ -377,6 +380,7 @@ public class FlatTableHeaderUI
|
|||||||
if( background != null ) {
|
if( background != null ) {
|
||||||
oldBackground = l.getBackground();
|
oldBackground = l.getBackground();
|
||||||
oldOpaque = l.isOpaque();
|
oldOpaque = l.isOpaque();
|
||||||
|
restoreBackground = true;
|
||||||
l.setBackground( FlatUIUtils.deriveColor( background, header.getBackground() ) );
|
l.setBackground( FlatUIUtils.deriveColor( background, header.getBackground() ) );
|
||||||
l.setOpaque( true );
|
l.setOpaque( true );
|
||||||
}
|
}
|
||||||
@@ -415,7 +419,7 @@ public class FlatTableHeaderUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// restore modified renderer component properties
|
// restore modified renderer component properties
|
||||||
if( oldBackground != null )
|
if( restoreBackground )
|
||||||
l.setBackground( oldBackground );
|
l.setBackground( oldBackground );
|
||||||
if( oldForeground != null )
|
if( oldForeground != null )
|
||||||
l.setForeground( oldForeground );
|
l.setForeground( oldForeground );
|
||||||
|
|||||||
Reference in New Issue
Block a user