< prev index next >
test/javax/swing/JPopupMenu/6583251/bug6583251.java
Print this page
*** 23,33 ****
* questions.
*/
/*
@test
! @bug 6583251
@summary One more ClassCastException in Swing with TrayIcon
@author Alexander Potochkin
@run main bug6583251
*/
--- 23,33 ----
* questions.
*/
/*
@test
! @bug 6583251 8130481
@summary One more ClassCastException in Swing with TrayIcon
@author Alexander Potochkin
@run main bug6583251
*/
*** 54,64 ****
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
!
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createGui();
}
});
--- 54,64 ----
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
! if (SystemTray.isSupported()) {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createGui();
}
});
*** 66,77 ****
--- 66,85 ----
Robot robot = new Robot();
robot.waitForIdle();
menu.show(frame, 0, 0);
robot.waitForIdle();
+ try {
TrayIcon trayIcon = new TrayIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB));
MouseEvent ev = new MouseEvent(
new JButton(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, false);
ev.setSource(trayIcon);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ev);
+ } catch(UnsupportedOperationException e) {
+ System.out.println("Tray icon unsupported. Skipping the test. " + e.getMessage());
+ }
+
+ } else {
+ System.out.println("SystemTray not supported. " + "Test is skipped.");
+ }
}
}
< prev index next >