With the help of this library you can extract icons in whatever size you want from every file no matter if folder or file.
BufferedImage image = JIconExtract.getIconForFile(128,128,"C:\\Windows\\explorer.exe");
jna-5.5.0.jar (https://github.com/java-native-access/jna)
jna-platform-5.5.0.jar (https://github.com/java-native-access/jna)
- Windows
https://github.com/MrMarnic/JIconExtractReloaded/releases/download/v1.0/JIconExtractReloaded.jar
You are free to use it in your project.