mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-15 16:27:13 -06:00
FileChooser: catch NPE in Java 21 when getting icon for .exe files that use default Windows exe icon (see https://bugs.openjdk.org/browse/JDK-8320692)
This commit is contained in:
@@ -19,12 +19,15 @@ FlatLaf Change Log
|
||||
|
||||
- Button and ToggleButton: Selected buttons did not use explicitly set
|
||||
foreground color. (issue 756)
|
||||
- Table: Switching theme looses table grid and intercell spacing. (issues #733
|
||||
and #750)
|
||||
- FileChooser: Catch NPE in Java 21 when getting icon for `.exe` files that use
|
||||
default Windows exe icon. (see
|
||||
[JDK-8320692](https://bugs.openjdk.org/browse/JDK-8320692))
|
||||
- OptionPane: Fixed styling custom panel background in `JOptionPane`. (issue
|
||||
#761)
|
||||
- ScrollPane: Styling ScrollPane border properties did not work if view
|
||||
component is a Table.
|
||||
- Table: Switching theme looses table grid and intercell spacing. (issues #733
|
||||
and #750)
|
||||
- Table: Fixed background of `boolean` columns when using alternating row
|
||||
colors. (issue #780)
|
||||
- TableHeader: No longer temporary replace header cell renderer while painting.
|
||||
|
||||
@@ -370,7 +370,11 @@ public class FlatFileChooserUI
|
||||
|
||||
// get system icon
|
||||
if( f != null ) {
|
||||
try {
|
||||
icon = getFileChooser().getFileSystemView().getSystemIcon( f );
|
||||
} catch( NullPointerException ex ) {
|
||||
// Java 21 may throw a NPE for exe files that use default Windows exe icon
|
||||
}
|
||||
|
||||
if( icon != null ) {
|
||||
if( icon instanceof ImageIcon )
|
||||
@@ -540,6 +544,7 @@ public class FlatFileChooserUI
|
||||
if( doNotUseSystemIcons() )
|
||||
return new FlatFileViewDirectoryIcon();
|
||||
|
||||
try {
|
||||
// Java 17+ supports getting larger system icons
|
||||
try {
|
||||
if( SystemInfo.isJava_17_orLater ) {
|
||||
@@ -565,6 +570,10 @@ public class FlatFileChooserUI
|
||||
|
||||
// get system icon in default size 16x16
|
||||
return fsv.getSystemIcon( file );
|
||||
} catch( NullPointerException ex ) {
|
||||
// Java 21 may throw a NPE for exe files that use default Windows exe icon
|
||||
return new FlatFileViewDirectoryIcon();
|
||||
}
|
||||
}
|
||||
|
||||
protected void directoryChanged( File file ) {
|
||||
|
||||
Reference in New Issue
Block a user