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

Clarify SystemTray.getTrayIconSize returns size in logical pixels

XMLWordPrintable

      The javadoc for the java.awt.SystemTray.getTrayIconSize method states:

      “Returns the size, *in pixels*, of the space that a tray icon will occupy in the system tray.”

      It is not quite correct. On a High DPI screen with scale of 200%, the icon will be 32×32 on Windows. Yet the method always returns 16×16.

      The scale of the main display on macOS isn't taken into account either.

      The spec should be updated to clarify the size is user space / logical pixels.


      A simple reproducer:
      import java.awt.SystemTray;

      public class SysTrayIconSize {
          public static void main(String[] args) {
              System.out.println(SystemTray.getSystemTray().getTrayIconSize());
          }
      }

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

              Created:
              Updated: