Setting file icon in java

//Getting a file icon
File file = new File("t2.png");
FileSystemView view = FileSystemView.getFileSystemView();       
Icon icon = view.getSystemIcon(file);

      

Getting the file icon can be done as above in java.

How about setting a file icon? How can I do that?

+3


source to share


1 answer


Executable files (.exe files on Windows) are the only files I know of that have individual "custom" icons. All other files have the same icon according to their file extension. For example, html files may have the Internet Explorer or Mozilla Firefox logo, depending on the application that opens them by default. PDF files usually have the Adobe logo. As indicated by "ulmangt", you can specify your own icons for files with specific file extensions by configuring the default program used to open them. Good luck!



+1


source







All Articles