< prev index next >
test/jdk/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -23,11 +23,11 @@
/**
* @test
* @key headful
- * @bug 8150176 8151773 8150176
+ * @bug 8150176 8151773 8150176 8241791
* @summary Check if correct resolution variant is used for tray icon.
* @run main/manual/othervm -Dsun.java2d.uiScale=2 MultiResolutionTrayIconTest
*/
import java.awt.Color;
import java.awt.Dimension;
@@ -71,11 +71,15 @@
public static void createUI() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
mainFrame = new JFrame("TrayIcon Test");
- boolean trayIsSupported = SystemTray.isSupported();
+ if (!SystemTray.isSupported()) {
+ System.out.println("system tray is not supported");
+ latch.countDown();
+ return;
+ }
tray = SystemTray.getSystemTray();
Dimension d = tray.getTrayIconSize();
icon = new TrayIcon(createIcon(d.width, d.height));
icon.setImageAutoSize(true);
layout = new GridBagLayout();
@@ -96,20 +100,13 @@
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
mainControlPanel.add(instructionText, gbc);
startButton = new JButton("Start");
startButton.setActionCommand("Start");
- if (trayIsSupported) {
-
startButton.addActionListener((ActionEvent e) -> {
doTest();
});
- } else {
- startButton.setEnabled(false);
- System.out.println("system tray is not supported");
- latch.countDown();
- }
gbc.gridx = 0;
gbc.gridy = 0;
resultButtonPanel.add(startButton, gbc);
passButton = new JButton("Pass");
@@ -193,6 +190,5 @@
if (tray != null) {
tray.remove(icon);
}
}
}
-
< prev index next >