Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8156183

Alternative needed in Java 9 for getting large file icon

    Details

      Description

      A DESCRIPTION OF THE REQUEST :
      It is useful to be able to display the system icon for a file or folder. In Java 8 there are two ways to do that:

      1. javax.swing.filechooser.FileSystemView.getFileSystemView().getSystemIcon(file); This retrieves only a tiny 16x16-pixel icon.

      2. sun.awt.shell.ShellFolder.getShellFolder(file).getIcon(getLargeIcon). This accepts a boolean argument specifying whether to get a "small" or "large" icon, which in practice means 16x16 or 32x32.

      While 32x32 isn't large by the standards of current-millennium operating systems, it is still four times the area of the best icon available via the public API, so it is useful. In my application (a media file browser), I use the ShellFolder class to get the 32x32 icon. With Java 9's module enforcement, that method is now blocked. Only the tiniest icon is available.

      I request that either the sun.awt.shell package be made publicly accessible, or a new `FileSystemView` method be made available accepting some hint as to the desired size, or that would return a `List<Icon>` of all the available sizes, or that would return an instance of the new Java 9 `java.awt.image.MultiResolutionImage` representing all the available sizes, or that such a method be added to `java.awt.Desktop` or `java.awt.Toolkit` instead. Like the existing methods in Java 8, any new method needs to work for unreal folders like the Windows "Computer" and "Network" locations too.

      There are several good API possibilities, and I don't care what it is or where it is, just so long as there's some way to continue to use large icons.

      JUSTIFICATION :
      Limiting new Java applications to displaying 16x16 icons for files is not good enough.


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psadhukhan Prasanta Sadhukhan
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: