-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b140
Please compile/run the following code on HiDPI machine (or use sun.java2d.uiScale option):
import java.awt.*;
import java.awt.image.*;
public class TrayIconTest {
private static BufferedImage generateImage(int w, int h, int scale, Color c) {
int x = w * scale, y = h * scale;
BufferedImage img = new BufferedImage(x, y, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
g.setColor(c);
g.fillRect(0, 0, x, y);
g.setColor(Color.WHITE);
g.fillRect(x / 3, y / 3, x / 3, y / 3);
return img;
}
private static BaseMultiResolutionImage createIcon(int w, int h) {
return new BaseMultiResolutionImage(
new BufferedImage[]{generateImage(w, h, 1, Color.RED),
generateImage(w, h, 2, Color.GREEN)});
}
public static void main(String[] args) throws Exception {
if (!SystemTray.isSupported()) {
System.err.println("tray is not supported");
return;
}
SystemTray tray = SystemTray.getSystemTray();
Dimension d = tray.getTrayIconSize();
System.out.println("icon size: " + d.width + "x" + d.height);
tray.add(new TrayIcon(createIcon(d.width, d.height)));
}
}
expected: high-resolution ("green") icon will apear in the tray. in fact - the "red" one appears.
Win 8 + HiDPI, JDK9 b106
import java.awt.*;
import java.awt.image.*;
public class TrayIconTest {
private static BufferedImage generateImage(int w, int h, int scale, Color c) {
int x = w * scale, y = h * scale;
BufferedImage img = new BufferedImage(x, y, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
g.setColor(c);
g.fillRect(0, 0, x, y);
g.setColor(Color.WHITE);
g.fillRect(x / 3, y / 3, x / 3, y / 3);
return img;
}
private static BaseMultiResolutionImage createIcon(int w, int h) {
return new BaseMultiResolutionImage(
new BufferedImage[]{generateImage(w, h, 1, Color.RED),
generateImage(w, h, 2, Color.GREEN)});
}
public static void main(String[] args) throws Exception {
if (!SystemTray.isSupported()) {
System.err.println("tray is not supported");
return;
}
SystemTray tray = SystemTray.getSystemTray();
Dimension d = tray.getTrayIconSize();
System.out.println("icon size: " + d.width + "x" + d.height);
tray.add(new TrayIcon(createIcon(d.width, d.height)));
}
}
expected: high-resolution ("green") icon will apear in the tray. in fact - the "red" one appears.
Win 8 + HiDPI, JDK9 b106
- relates to
-
JDK-8149371 multi-res. image: -Dsun.java2d.uiScale does not work for Window icons (some ambiguity for Window.setIconImages()?)
-
- Resolved
-
-
JDK-8154551 HiDPI Ubuntu Unity 16 and SystemTray icon
-
- Closed
-
-
JDK-8151773 [macosx] TrayIcon.imageAutoSize property is ignored
-
- Resolved
-
-
JDK-8150643 [TEST] add test for JDK-8150176
-
- Resolved
-