java get icon for file type

Java
FileSystemView.getFileSystemView().getSystemIcon(file)
Source

Also in Java: