-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
7
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b120)
Java HotSpot(TM) Client VM (build 17.0-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP3 32bit
A DESCRIPTION OF THE PROBLEM :
We find that TrayIcon popup menu seem have some problem in latest java7 b120, We use the following class to test. http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/. We can see that on java6 and java7 b72 the TrayIcon popup menu function property. But with java7 b115 to b120, the popup menu doesn't showup. Is the TrayIcon popup function going to have big change?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/
We use this class to test TrayIcon function
1. After compile and run should see a TrayIcon on the bottom-right taskBar area
2. Then we right click the TrayIcon with mouse over it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The expected result is when right click on TrayIcon, a popup menu should show up for user select.
ACTUAL -
No popup menu showup and no exception received
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No exception received
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Copyright 2005 Sun Microsystems, Inc. ALL RIGHTS RESERVED
* Use of this software is authorized pursuant to the terms of the
* license found at http://developers.sun.com/berkeley_license.html
*
*/
package systemtray;
import java.awt.*;
import java.awt.event.*;
public class SystemTrayTest
{
public SystemTrayTest()
{
final TrayIcon trayIcon;
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
Image image = Toolkit.getDefaultToolkit().getImage("tray.gif");
MouseListener mouseListener = new MouseListener() {
public void mouseClicked(MouseEvent e) {
System.out.println("Tray Icon - Mouse clicked!");
}
public void mouseEntered(MouseEvent e) {
System.out.println("Tray Icon - Mouse entered!");
}
public void mouseExited(MouseEvent e) {
System.out.println("Tray Icon - Mouse exited!");
}
public void mousePressed(MouseEvent e) {
System.out.println("Tray Icon - Mouse pressed!");
}
public void mouseReleased(MouseEvent e) {
System.out.println("Tray Icon - Mouse released!");
}
};
ActionListener exitListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Exiting...");
System.exit(0);
}
};
PopupMenu popup = new PopupMenu();
MenuItem defaultItem = new MenuItem("Exit");
defaultItem.addActionListener(exitListener);
popup.add(defaultItem);
trayIcon = new TrayIcon(image, "Tray Demo", popup);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
trayIcon.displayMessage("Action Event",
"An Action Event Has Been Peformed!",
TrayIcon.MessageType.INFO);
}
};
trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(actionListener);
trayIcon.addMouseListener(mouseListener);
// Depending on which Mustang build you have, you may need to uncomment
// out the following code to check for an AWTException when you add
// an image to the system tray.
// try {
tray.add(trayIcon);
// } catch (AWTException e) {
// System.err.println("TrayIcon could not be added.");
// }
} else {
System.err.println("System tray is currently not supported.");
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
SystemTrayTest main = new SystemTrayTest();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use jre 6 or jdk7 b72
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b120)
Java HotSpot(TM) Client VM (build 17.0-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP3 32bit
A DESCRIPTION OF THE PROBLEM :
We find that TrayIcon popup menu seem have some problem in latest java7 b120, We use the following class to test. http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/. We can see that on java6 and java7 b72 the TrayIcon popup menu function property. But with java7 b115 to b120, the popup menu doesn't showup. Is the TrayIcon popup function going to have big change?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/
We use this class to test TrayIcon function
1. After compile and run should see a TrayIcon on the bottom-right taskBar area
2. Then we right click the TrayIcon with mouse over it
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The expected result is when right click on TrayIcon, a popup menu should show up for user select.
ACTUAL -
No popup menu showup and no exception received
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No exception received
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Copyright 2005 Sun Microsystems, Inc. ALL RIGHTS RESERVED
* Use of this software is authorized pursuant to the terms of the
* license found at http://developers.sun.com/berkeley_license.html
*
*/
package systemtray;
import java.awt.*;
import java.awt.event.*;
public class SystemTrayTest
{
public SystemTrayTest()
{
final TrayIcon trayIcon;
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
Image image = Toolkit.getDefaultToolkit().getImage("tray.gif");
MouseListener mouseListener = new MouseListener() {
public void mouseClicked(MouseEvent e) {
System.out.println("Tray Icon - Mouse clicked!");
}
public void mouseEntered(MouseEvent e) {
System.out.println("Tray Icon - Mouse entered!");
}
public void mouseExited(MouseEvent e) {
System.out.println("Tray Icon - Mouse exited!");
}
public void mousePressed(MouseEvent e) {
System.out.println("Tray Icon - Mouse pressed!");
}
public void mouseReleased(MouseEvent e) {
System.out.println("Tray Icon - Mouse released!");
}
};
ActionListener exitListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Exiting...");
System.exit(0);
}
};
PopupMenu popup = new PopupMenu();
MenuItem defaultItem = new MenuItem("Exit");
defaultItem.addActionListener(exitListener);
popup.add(defaultItem);
trayIcon = new TrayIcon(image, "Tray Demo", popup);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
trayIcon.displayMessage("Action Event",
"An Action Event Has Been Peformed!",
TrayIcon.MessageType.INFO);
}
};
trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(actionListener);
trayIcon.addMouseListener(mouseListener);
// Depending on which Mustang build you have, you may need to uncomment
// out the following code to check for an AWTException when you add
// an image to the system tray.
// try {
tray.add(trayIcon);
// } catch (AWTException e) {
// System.err.println("TrayIcon could not be added.");
// }
} else {
System.err.println("System tray is currently not supported.");
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
SystemTrayTest main = new SystemTrayTest();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use jre 6 or jdk7 b72
- duplicates
-
JDK-6996708 The event on the tray icon does not trigger and there is no message printed.
- Closed