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

Extract only the requested icon size

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P3
    • tbd
    • 17, 18, 19, 20
    • client-libs
    • None

    Description

      The current implementation of FileSystemView.getSystemIcon(java.io.File,int,int) returns a MultiResolutionImage if possible. Internally, it requests a predefined set of icons from Window [2][3].

      Not all the sizes may be needed or used. Only the required size should be requested.

      This point came up during code review for JDK-8282526 [4].

      As pointed out in the discussion, implementing this could very tricky. The icon has to store file details to fetch the icon of the different size, which needs to be performed on the COM thread. The scale is not known until the icon is displayed.


      [1] https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/filechooser/FileSystemView.html#getSystemIcon(java.io.File,int,int)
      [2] https://github.com/openjdk/jdk/blob/7f52c50ba32eecf5f379f8db30ac6a5cc50b3b66/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java#L90
      [3] https://github.com/openjdk/jdk/blob/7f52c50ba32eecf5f379f8db30ac6a5cc50b3b66/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java#L1144-L1148
      [4] https://github.com/openjdk/jdk/pull/7805#discussion_r894171541
      https://github.com/openjdk/jdk/pull/7805#discussion_r916952460

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aivanov Alexey Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: