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

Ampersand not displayed in TrayIcon tooltip on winXP

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      JDK 6 beta2

      A DESCRIPTION OF THE PROBLEM :
      The ampersand character is not displayed in the TrayIcon tooltip.
      The same String is displayed well with TrayIcon.displayMessage() which accepts Strings just like TrayIcon.setTooltip() or TrayIcon's constructor.

      Additional information: seeing the same bug on 2 different computers with
      java6 beta2, same windows XP. Same effect when compiling and running
      inside Eclipse, or the command line (javac, java)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. compile the class below
      2. save an image for the systray icon as c:\trayicon.png
      3. run the class (java ampersand_error)
      4. see the systray bubble showing: -&- (it's good)
      5. see the tooltip on the systray icon, the & char is not displayed but
      the others are. You actually see only: -- (it's wrong, & is
      missing)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      tooltip output: -&-
      ACTUAL -
      tooltip output: --

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.AWTException;
      import java.awt.Image;
      import java.awt.PopupMenu;
      import java.awt.SystemTray;
      import java.awt.Toolkit;
      import java.awt.TrayIcon;
      import java.awt.TrayIcon.MessageType;

      public class ampersand_error {
       
              static SystemTray tray;
              static TrayIcon trayicon;
       
              public static void main(String[] args) {

                      tray = SystemTray.getSystemTray();
                      Image image =
      Toolkit.getDefaultToolkit().getImage("c:/trayicon.png");
                      PopupMenu popupmenu = new PopupMenu();
                      //bug seems to be here when setting the tooltip:
                      trayicon = new TrayIcon(image, "-&-", popupmenu);

                      try {
                              tray.add(trayicon);
                      } catch (AWTException e) {
                              e.printStackTrace();
                      }
                      // this works well:
                      trayicon.displayMessage("-&-", "-&-", MessageType.INFO);
               }
               public void finalize ()
              {
                      tray.remove(trayicon);
              }
      }
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            Assignee:
            bagiras Oleg Pekhovskiy (Inactive)
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: