mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
FileChooser: workaround for crash on Windows with Java 17 32bit (issue #403)
(cherry picked from commits44d8545c09and33b25c1129)
This commit is contained in:
@@ -15,6 +15,8 @@ FlatLaf Change Log
|
|||||||
`TextComponent.selectAllOnFocusPolicy` is `once` (the default) or `always`.
|
`TextComponent.selectAllOnFocusPolicy` is `once` (the default) or `always`.
|
||||||
(issue #395)
|
(issue #395)
|
||||||
- Linux: Fixed NPE when using `java.awt.TrayIcon`. (issue #405)
|
- Linux: Fixed NPE when using `java.awt.TrayIcon`. (issue #405)
|
||||||
|
- FileChooser: Workaround for crash on Windows with Java 17 32-bit (disabled
|
||||||
|
Windows icons). Java 17 64-bit is not affected. (issue #403)
|
||||||
|
|
||||||
|
|
||||||
## 1.6.1
|
## 1.6.1
|
||||||
|
|||||||
@@ -262,12 +262,20 @@ public class FlatFileChooserUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileView getFileView( JFileChooser fc ) {
|
public FileView getFileView( JFileChooser fc ) {
|
||||||
return fileView;
|
return doNotUseSystemIcons() ? super.getFileView( fc ) : fileView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearIconCache() {
|
public void clearIconCache() {
|
||||||
fileView.clearIconCache();
|
if( doNotUseSystemIcons() )
|
||||||
|
super.clearIconCache();
|
||||||
|
else
|
||||||
|
fileView.clearIconCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean doNotUseSystemIcons() {
|
||||||
|
// Java 17 32bit craches on Windows when using system icons
|
||||||
|
return SystemInfo.isWindows && SystemInfo.isJava_17_orLater && !SystemInfo.isX86_64;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- class FlatFileView -------------------------------------------------
|
//---- class FlatFileView -------------------------------------------------
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class SystemInfo
|
|||||||
public static final boolean isJava_9_orLater;
|
public static final boolean isJava_9_orLater;
|
||||||
public static final boolean isJava_11_orLater;
|
public static final boolean isJava_11_orLater;
|
||||||
public static final boolean isJava_15_orLater;
|
public static final boolean isJava_15_orLater;
|
||||||
|
/** @since 2 */ public static final boolean isJava_17_orLater;
|
||||||
|
|
||||||
// Java VMs
|
// Java VMs
|
||||||
public static final boolean isJetBrainsJVM;
|
public static final boolean isJetBrainsJVM;
|
||||||
@@ -82,6 +83,7 @@ public class SystemInfo
|
|||||||
isJava_9_orLater = (javaVersion >= toVersion( 9, 0, 0, 0 ));
|
isJava_9_orLater = (javaVersion >= toVersion( 9, 0, 0, 0 ));
|
||||||
isJava_11_orLater = (javaVersion >= toVersion( 11, 0, 0, 0 ));
|
isJava_11_orLater = (javaVersion >= toVersion( 11, 0, 0, 0 ));
|
||||||
isJava_15_orLater = (javaVersion >= toVersion( 15, 0, 0, 0 ));
|
isJava_15_orLater = (javaVersion >= toVersion( 15, 0, 0, 0 ));
|
||||||
|
isJava_17_orLater = (javaVersion >= toVersion( 17, 0, 0, 0 ));
|
||||||
|
|
||||||
// Java VMs
|
// Java VMs
|
||||||
isJetBrainsJVM = System.getProperty( "java.vm.vendor", "Unknown" )
|
isJetBrainsJVM = System.getProperty( "java.vm.vendor", "Unknown" )
|
||||||
|
|||||||
Reference in New Issue
Block a user