提取我的系统的图标 [英] Fetch icons of my System

查看:57
本文介绍了提取我的系统的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个显示我的C和D驱动器的程序.但是输出中出现的图标是javaFx的默认图标.我只想显示系统的所有图标.例如,对于视频,它应该显示我系统的媒体图标,而不是javaFx中的默认图标.

I have made a program which shows my C and D drive. But the icons which are coming in my output are the default icons of javaFx. I just want to show all icons of my system. For example for videos it should show the media icon for my system, not the default icon in javaFx.

推荐答案

此问题类似于:

该相关问题未提供本机JavaFX解决方案.

That related question does not provide a native JavaFX solution.

但是,目前没有本机JavaFX解决方案,因此最好:

However, there is currently no native JavaFX solution, so it would be best to:

  1. 使用类似问题中引用的Swing类.
  2. 使用以下命令从图标中提取BufferedImage:

  1. Use the Swing classes referenced in the similar question.
  2. Extract a BufferedImage from the icons, using:

相关问题建议(而且我还没有尝试过):

The related question suggests (and I haven't tried it) to do:

Icon icon = FileSystemView.getFileSystemView().getSystemIcon(File);

或者(如果是OS X):

Or (if OS X):

javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
Icon icon = fc.getUI().getFileView(fc).getIcon(file);

写下此答案后,我发现了以下类似问题(也许甚至是重复的):

After writing this answer, I found the following question which is similar (perhaps this is even a duplicate):

这篇关于提取我的系统的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆