Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8322299 | jfx17.0.10 | Johan Vos | P4 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.11.6 (15G1421)
EXTRA RELEVANT SYSTEM CONFIGURATION :
MacBook Pro (Retina, 13-inch, Mid 2014)
A DESCRIPTION OF THE PROBLEM :
I want to show hi-dpi icons in system menu on macOS with Retina display. So, I have created 2 icons `1.png` (16x16) and `1@2x.png` (32x32) and put them to MenuItem:
menuItem1.setGraphic(new ImageView("/com/protonail/icons/1.png"));
I expect that the JavaFX will do the following:
1) Choose 1@2x.png icon
2) Show it in hi-dpi resolution in system menu as small icon
but instead the JavaFX doesn't respect hi-dpi resolution and show 1@2x.png icon as a big icon.
Look at this screenshot: http://imgur.com/a/UESQp
Hi-dpi icon looks like icon for 1 menu item, but should looks like as icon for 2 menu item.
Here is project for reproduce problem: https://github.com/maxd/big-system-menu-icons
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
git clone git@github.com:maxd/big-system-menu-icons.git
cd big-system-menu-icons
mvn clean exec:java
then click `Icons` menu in system menu.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JavaFX must respect hi-dpi icons in system macOS menu and display them as small icons.
ACTUAL -
JavaFX show hi-dpi icons as big icons.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package com.protonail;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
Application.launch(Main.class);
}
public void start(Stage primaryStage) throws Exception {
MenuItem menuItem1 = new MenuItem("1");
menuItem1.setGraphic(new ImageView("/com/protonail/icons/1.png")); // 1.png (16x16) and 1@2x.png (32x32)
MenuItem menuItem2 = new MenuItem("2");
menuItem2.setGraphic(new ImageView("/com/protonail/icons/2.png")); // 2.png (16x16) only
Menu iconsMenu = new Menu("Icons");
iconsMenu.getItems().addAll(menuItem1, menuItem2);
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(true);
menuBar.getMenus().add(iconsMenu);
Scene scene = new Scene(menuBar);
primaryStage.setScene(scene);
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I can't found appropriate workaround yet.
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.11.6 (15G1421)
EXTRA RELEVANT SYSTEM CONFIGURATION :
MacBook Pro (Retina, 13-inch, Mid 2014)
A DESCRIPTION OF THE PROBLEM :
I want to show hi-dpi icons in system menu on macOS with Retina display. So, I have created 2 icons `1.png` (16x16) and `1@2x.png` (32x32) and put them to MenuItem:
menuItem1.setGraphic(new ImageView("/com/protonail/icons/1.png"));
I expect that the JavaFX will do the following:
1) Choose 1@2x.png icon
2) Show it in hi-dpi resolution in system menu as small icon
but instead the JavaFX doesn't respect hi-dpi resolution and show 1@2x.png icon as a big icon.
Look at this screenshot: http://imgur.com/a/UESQp
Hi-dpi icon looks like icon for 1 menu item, but should looks like as icon for 2 menu item.
Here is project for reproduce problem: https://github.com/maxd/big-system-menu-icons
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
git clone git@github.com:maxd/big-system-menu-icons.git
cd big-system-menu-icons
mvn clean exec:java
then click `Icons` menu in system menu.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JavaFX must respect hi-dpi icons in system macOS menu and display them as small icons.
ACTUAL -
JavaFX show hi-dpi icons as big icons.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package com.protonail;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
Application.launch(Main.class);
}
public void start(Stage primaryStage) throws Exception {
MenuItem menuItem1 = new MenuItem("1");
menuItem1.setGraphic(new ImageView("/com/protonail/icons/1.png")); // 1.png (16x16) and 1@2x.png (32x32)
MenuItem menuItem2 = new MenuItem("2");
menuItem2.setGraphic(new ImageView("/com/protonail/icons/2.png")); // 2.png (16x16) only
Menu iconsMenu = new Menu("Icons");
iconsMenu.getItems().addAll(menuItem1, menuItem2);
MenuBar menuBar = new MenuBar();
menuBar.setUseSystemMenuBar(true);
menuBar.getMenus().add(iconsMenu);
Scene scene = new Scene(menuBar);
primaryStage.setScene(scene);
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I can't found appropriate workaround yet.
- backported by
-
JDK-8322299 JavaFX show big icons in system menu on macOS with Retina display
- Resolved