我正在用 java 编写一段代码,我需要获取不同大小的文件系统图标。 我知道要获取文件系统图标,我应该使用这个:
File file = new File("Whatever.txt");
FileSystemView view = FileSystemView.getFileSystemView();
Icon icon = view.getSystemIcon(file);
但此代码返回最小尺寸的图标。 我应该怎么做才能获得其他尺寸?
最佳答案
对于 32x32 图标,您可以使用 ShellFolder。
sun.awt.shell.ShellFolder.getShellFolder( file ).getIcon( true )
或者使用 JNI Api 。两种“解决方案”都已经讨论过here
关于java - 如何获取文件的所有不同大小的系统图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9165174/