Skip to content

Commit

Permalink
FileChooser: Fixed crash on Windows with Java 17 to 17.0.2 32-bit. Ja…
Browse files Browse the repository at this point in the history
…va 17 64-bit is not affected. (regression since FlatLaf 2.3; PR #522, see also issue #403)
  • Loading branch information
DevCharly committed Aug 7, 2023
1 parent afaa2c8 commit 4b49906
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -61,6 +61,9 @@ FlatLaf Change Log
listener on that formatted text field. (issue #698)
- PopupMenu: Make sure that popup menu does not overlap any operating system
task bar. (issue #701)
- FileChooser: Fixed crash on Windows with Java 17 to 17.0.2 32-bit. Java 17
64-bit is not affected. (regression since FlatLaf 2.3; PR #522, see also issue
#403)

#### Incompatibilities

Expand Down
Expand Up @@ -53,6 +53,7 @@
import javax.swing.plaf.metal.MetalFileChooserUI;
import javax.swing.table.TableCellRenderer;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.icons.FlatFileViewDirectoryIcon;
import com.formdev.flatlaf.util.LoggingFacade;
import com.formdev.flatlaf.util.ScaledImageIcon;
import com.formdev.flatlaf.util.SystemInfo;
Expand Down Expand Up @@ -346,7 +347,7 @@ public void clearIconCache() {
fileView.clearIconCache();
}

private boolean doNotUseSystemIcons() {
private static boolean doNotUseSystemIcons() {
// Java 17 32bit craches on Windows when using system icons
// fixed in Java 18+ (see https://bugs.openjdk.java.net/browse/JDK-8277299)
return SystemInfo.isWindows &&
Expand Down Expand Up @@ -526,6 +527,9 @@ protected Icon getIcon( FileSystemView fsv, File file ) {
return icon;
}

if( doNotUseSystemIcons() )
return new FlatFileViewDirectoryIcon();

// Java 17+ supports getting larger system icons
try {
if( SystemInfo.isJava_17_orLater ) {
Expand Down

0 comments on commit 4b49906

Please sign in to comment.