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

SystemTray implementation does not match the L&F of native Gnome system tray applications

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: solaris_11
    • Fix Version/s: 6-pool
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_nevada

      Description

      I recently attempted to create a system tray application for Gnome/OpenSolaris
      using the Java SystemTray API. Several issues in the implementation of that API
      prevented a robust, polished application. These issues were observed on
      OpenSolaris/Gnome, but some appear to affect other platforms as well:

      o SystemTray.getTrayIconSize returns hard-coded values that may not correspond
        to actual system tray dimensions

          On Gnome/X systems, SystemTray.getTrayIconSize always returns 24x24,
          regardless of the height/width of the system tray. For larger system trays,
          this can result in the icon for a Java system tray application being
          significantly smaller than its peers (see the lock tray icon in the attached
          java-systemtray.png).

          Besides a distracting and non-conforming appearance, this can also affect
          the accessability of the system tray application: users who rely on large
          system tray icons may not be able to find or use the smaller icon of a Java
          system tray application.

      o System tray icons are not centered

          When a TrayIcon is placed in a system tray that is taller or wider than the
          icon, the icon is not centered on the tray. Instead, the icon gravitates to
          the edge of the system tray (see the lock tray icon in the attached
          java-systemtray.png). When combined with the above issue, this further
          detracts from the appearance of Java system tray applications.

      o TrayIcons ignore system tray background

          TrayIcons placed in the system tray show a distinct solid gray background,
          rather than the "native" background of the system tray (see the lock tray
          icon in the attached java-systemtray.png). Transparent images used within
          TrayIcons still have this gray background. On systems with a solid or
          textured system tray background, the difference can be stark and
          distracting. When combined with the above issues, this further detracts
          from the appearance of Java system tray applications.

          TrayIcons should respect transparent sections of the attached icons, and
          should allow the system tray background to show through the unused portions
          of the Java system tray application area, as with native system tray
          applications.

      o TrayIcon menus don't match the appearance of native system tray menus

          The default menu support in the TrayIcon API shows a menu with a completely
          different look and feel than the menus of native system tray applications.
          See the attached java-systemtray-menu.png.

          A partial workaround here is to use a JPopupMenu and a MouseListener; such
          an implementation should most likely be the default for the TrayIcon API.

      o TrayIcon menus don't match the placement of native system tray menus

          TrayIcon menus appear at the spot of the mouse click, rather than just above
          the system tray on Gnome. Compare the lock tray icon in the attached
          java-systemtray-menu.png to the native Gnome volume control tray icon in the
          attached gnome-systemtray-menu.png. Note that the menu of the latter native
          tray icon abuts the system tray, whereas the menu of the former Java tray
          icon awkwardly overlaps the system tray.

          The placement of menus of Java TrayIcons should follow the conventions of
          the native system tray menus.

      o System tray applications lack the ability to place a popup window against the
        system tray

          A fairly common requirement for system tray applications is to place a popup
          window (not a menu) abutting the system tray. Because the Java system tray
          API does not provide the geometry (position and size) or alignment (bottom,
          top, etc.) of the system tray or the tray icon itself, Java system tray
          applications do not have the ability to place such a window accurately.

          The attached gnome-systemtray-popup.png shows how the native Gnome volume
          control tray icon elegantly places a popup abutting the system tray when
          clicked, a feat not possible with the limited Java system tray API.

          Note that the best a Java TrayIcon can do is place a window near the site of
          a mouse click.

          Note that this less-than-ideal placement also affects the popup messages
          shown with TrayIcon.displayMessage.

      o TrayIcon's popup messages don't match the look and feel of the native platform

          TrayIcon.displayMessage on Gnome shows a popup dialog that looks grossly out
          of place in the Gnome environment (see the attached
          java-systemtray-message.png). The light purple color scheme, the literal
          "X" character in the window's close button, the border of the close button,
          and the lack of spacing or border in the window is distractingly contrary to
          the look and feel of the native windows and popups in the Gnome environment.

          Contrast this with the windows implementation, which does a much better job
          at matching the native look of a system tray message (see the attached
          windows-systemtray-message.png).

          As the popup is clearly attempting to mimic the window decorations that a
          window manager might provide, one wonders why this implementation doesn't
          just use a Frame/JFrame here and delegate this functionality to the window
          manager.

          As a final comment, I might expect the placement of the message popup to not
          obscure the tray icon it refers to.

        Attachments

          Activity

            People

            • Assignee:
              denis Denis Fokin (Inactive)
              Reporter:
              stalley Stephen Talley (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: