-
Bug
-
Resolution: Fixed
-
P2
-
7u71, 8, 9
-
b36
-
x86_64
-
windows_10
FULL PRODUCT VERSION :
jdk 1.7.0_71
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Pro x64
EXTRA RELEVANT SYSTEM CONFIGURATION :
8GB RAM
i5-3470 CPU @ 3.20 GHZ
A DESCRIPTION OF THE PROBLEM :
On Windows 10 and only Windows 10. The TrayIcon class does not properly register that an action has been performed. For example, if you tell the trayIcon to send a message, then click on the message, it doesn't recognize that an action has been performed. If you are able to click several times on the message before it disappears it will register the action, however in past versions of windows it would only take a single click to register. Something related to the action listener added to the trayIcon in Windows 10 does not work. Please adjust your api to allow proper functionality for the actionListener in the TrayIcon class in windows 10.
REGRESSION. Last worked in version 8u66
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
TrayIcon trayIcon = new TrayIcon();
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("action registered");
}
});
simply create this tray icon and the action will not get called when trayIcon.displayMessage is called and the message is clicked on.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The action should be recognized and the words "action registered" should be printed to the console
ACTUAL -
nothing happens, the trayIcon message goes away
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package kaither;
import java.awt.*;
import java.awt.TrayIcon.MessageType;
import java.awt.event.*;
import java.net.URI;
import javax.swing.*;
public class TestSystemTrayIcon {
private final static SystemTray tray = SystemTray.getSystemTray();
private static TrayIcon trayIcon;
static int i = 1;
public static void main(String[] args) {
trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().getImage("broncosIcon.jpg"), "Kaither App");
JButton testBtn = new JButton("Test System Tray Message");
JFrame frame = new JFrame("Test System Tray");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Successfully clicking the icon will launch espn.com");
final JPanel panel = new JPanel(new BorderLayout());
panel.add(testBtn, BorderLayout.NORTH);
panel.add(label, BorderLayout.CENTER);
frame.setSize(new Dimension(500, 100));
frame.add(panel);
frame.setVisible(true);
try {
tray.add(trayIcon);
} catch (AWTException e) {
System.out.println(e.getStackTrace());
}
trayIcon.getActionCommand();
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Desktop.getDesktop().browse(new URI("http://www.espn.com"));
} catch (Exception e1) {
System.out.println(e1.getStackTrace());
}
}
});
testBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
trayIcon.displayMessage("Tray Icon Title", "This is a test message for the tray", MessageType.INFO);
}
});
}
}
---------- END SOURCE ----------
jdk 1.7.0_71
ADDITIONAL OS VERSION INFORMATION :
Windows 10 Pro x64
EXTRA RELEVANT SYSTEM CONFIGURATION :
8GB RAM
i5-3470 CPU @ 3.20 GHZ
A DESCRIPTION OF THE PROBLEM :
On Windows 10 and only Windows 10. The TrayIcon class does not properly register that an action has been performed. For example, if you tell the trayIcon to send a message, then click on the message, it doesn't recognize that an action has been performed. If you are able to click several times on the message before it disappears it will register the action, however in past versions of windows it would only take a single click to register. Something related to the action listener added to the trayIcon in Windows 10 does not work. Please adjust your api to allow proper functionality for the actionListener in the TrayIcon class in windows 10.
REGRESSION. Last worked in version 8u66
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
TrayIcon trayIcon = new TrayIcon();
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("action registered");
}
});
simply create this tray icon and the action will not get called when trayIcon.displayMessage is called and the message is clicked on.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The action should be recognized and the words "action registered" should be printed to the console
ACTUAL -
nothing happens, the trayIcon message goes away
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package kaither;
import java.awt.*;
import java.awt.TrayIcon.MessageType;
import java.awt.event.*;
import java.net.URI;
import javax.swing.*;
public class TestSystemTrayIcon {
private final static SystemTray tray = SystemTray.getSystemTray();
private static TrayIcon trayIcon;
static int i = 1;
public static void main(String[] args) {
trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().getImage("broncosIcon.jpg"), "Kaither App");
JButton testBtn = new JButton("Test System Tray Message");
JFrame frame = new JFrame("Test System Tray");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Successfully clicking the icon will launch espn.com");
final JPanel panel = new JPanel(new BorderLayout());
panel.add(testBtn, BorderLayout.NORTH);
panel.add(label, BorderLayout.CENTER);
frame.setSize(new Dimension(500, 100));
frame.add(panel);
frame.setVisible(true);
try {
tray.add(trayIcon);
} catch (AWTException e) {
System.out.println(e.getStackTrace());
}
trayIcon.getActionCommand();
trayIcon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Desktop.getDesktop().browse(new URI("http://www.espn.com"));
} catch (Exception e1) {
System.out.println(e1.getStackTrace());
}
}
});
testBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
trayIcon.displayMessage("Tray Icon Title", "This is a test message for the tray", MessageType.INFO);
}
});
}
}
---------- END SOURCE ----------