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.
Asked
Active
Viewed 1,184 times
1
-
1Please add your code (and screenshot) because I am not really sure what actualy the question is. – DVarga Jul 01 '16 at 12:47
1 Answers
2
This question is similar to:
That related question does not provide a native JavaFX solution.
However, there is currently no native JavaFX solution, so it would be best to:
- Use the Swing classes referenced in the similar question.
Extract a BufferedImage from the icons, using:
- Use SwingFXUtils.toFXImage to convert the BufferedImage to a JavaFX Image.
The related question suggests (and I haven't tried it) to do:
Icon icon = FileSystemView.getFileSystemView().getSystemIcon(File);
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):