mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
List: reduce painted cell width to preferred width in JFileChooser
This commit is contained in:
@@ -89,8 +89,19 @@ public class FlatListUI
|
|||||||
rendererComponent.setForeground( selectionInactiveForeground );
|
rendererComponent.setForeground( selectionInactiveForeground );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int x = rowBounds.x;
|
||||||
|
int width = rowBounds.width;
|
||||||
|
|
||||||
|
// reduce width to preferred width in JFileChooser
|
||||||
|
if( Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) ) ) {
|
||||||
|
int w = Math.min( width, rendererComponent.getPreferredSize().width + 4 );
|
||||||
|
if( !list.getComponentOrientation().isLeftToRight() )
|
||||||
|
x += (width - w);
|
||||||
|
width = w;
|
||||||
|
}
|
||||||
|
|
||||||
// paint renderer
|
// paint renderer
|
||||||
rendererPane.paintComponent( g, rendererComponent, list,
|
rendererPane.paintComponent( g, rendererComponent, list,
|
||||||
rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height, true );
|
x, rowBounds.y, width, rowBounds.height, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user