更新时间:2023-02-08 20:28:44
在OS X上, FileView 比更好用的FileSystemView 。我正在使用以下内容来获取文件图标:
On OS X, a FileView works much better than a FileSystemView. I'm using the following to get icons for files:
final JFileChooser fc = new JFileChooser();
//return fc.getFileView().getIcon(f); // will throw a null pointer
Icon result = fc.getUI().getFileView(fc).getIcon(f);