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

Try icon does not show display message

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b130)
      Java HotSpot(TM) Client VM (build 21.0-b02, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows Xp Sp3

      A DESCRIPTION OF THE PROBLEM :
      Adding an icon to system tray and displaying a popup/message works in 1.6.0_23 but not in 1.7.0-ea.

      That is,
      compiled with 1.6.0_23 and run with 1.6.0_23 is OK
      compiled with 1.6.0_23 and run with 1.7.0-ea is FAIL


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the test case with javac 1.6.0_23 and run with java 1.7.0-ea.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      New icon in system tray and a popup showing a message.
      ACTUAL -
      Icon appears in system tray but the popup/message goes missing. EDT seems dead...? No menus...

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      None. Program just hangs.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class TrayTest implements Runnable {
          private TrayIcon trayicon;

          public static void main(String[] args) {
              if (SystemTray.isSupported()) {
                  SwingUtilities.invokeLater(new TrayTest());
              }
          }

          @Override
          public void run() {
              trayicon = new TrayIcon(newIcon(16));
              trayicon.setToolTip("I'm here");
              PopupMenu popup = new PopupMenu();
              popup.add(new MenuItem("Exit")).addActionListener(new ActionListener() {
                  @Override
                  public void actionPerformed(ActionEvent e) {
                      SystemTray.getSystemTray().remove(trayicon);
                      System.exit(0);
                  }
              });
              trayicon.setPopupMenu(popup);
              try {
                  SystemTray.getSystemTray().add(trayicon);
              } catch (AWTException ex) {
                  ex.printStackTrace();
              }
              trayicon.displayMessage("TrayTest", "Started", TrayIcon.MessageType.INFO);
          }

          private BufferedImage newIcon(int size) {
              BufferedImage icon = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
              Graphics2D g2 = icon.createGraphics();
              g2.setBackground(Color.ORANGE);
              g2.clearRect(0, 0, size, size);
              g2.dispose();
              return icon;
          }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              denis Denis Fokin (Inactive)
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: