mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
TableHeader: fixed position of column separators in right-to-left component orientation; do not paint anything if column count is zero
This commit is contained in:
@@ -5,6 +5,8 @@ FlatLaf Change Log
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- TableHeader: Fixed position of column separators in right-to-left component
|
||||
orientation.
|
||||
- SwingX: Fixed striping background highlighting color (e.g. alternating table
|
||||
rows) in dark themes.
|
||||
|
||||
|
||||
@@ -98,10 +98,13 @@ public class FlatTableHeaderUI
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
if( header.getColumnModel().getColumnCount() <= 0 )
|
||||
return;
|
||||
|
||||
// do not paint borders if JTableHeader.setDefaultRenderer() was used
|
||||
TableCellRenderer defaultRenderer = header.getDefaultRenderer();
|
||||
boolean paintBorders = isSystemDefaultRenderer( defaultRenderer );
|
||||
if( !paintBorders && header.getColumnModel().getColumnCount() > 0 ) {
|
||||
if( !paintBorders ) {
|
||||
// check whether the renderer delegates to the system default renderer
|
||||
Component rendererComponent = defaultRenderer.getTableCellRendererComponent(
|
||||
header.getTable(), "", false, false, -1, 0 );
|
||||
@@ -168,7 +171,8 @@ public class FlatTableHeaderUI
|
||||
g2.fill( new Rectangle2D.Float( x - lineWidth, topLineIndent, lineWidth, height - bottomLineIndent ) );
|
||||
}
|
||||
} else {
|
||||
int x = width;
|
||||
Rectangle cellRect = header.getHeaderRect( 0 );
|
||||
int x = cellRect.x + cellRect.width;
|
||||
for( int i = 0; i < sepCount; i++ ) {
|
||||
x -= columnModel.getColumn( i ).getWidth();
|
||||
g2.fill( new Rectangle2D.Float( x - (i < sepCount - 1 ? lineWidth : 0),
|
||||
|
||||
Reference in New Issue
Block a user