Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8031573

[macosx] Checkmarks of JCheckBoxMenuItems aren't rendered in high resolution on Retina

    Details

    • Subcomponent:
    • Resolved In Build:
      b05
    • OS:
      os_x

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0-ea"
        Java(TM) SE Runtime Environment (build 1.8.0-ea-b121)
        Java HotSpot(TM) 64-Bit Server VM (build 25.0-b63, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Darwin mankell 13.0.2 Darwin Kernel Version 13.0.2: Sun Sep 29 19:38:57 PDT 2013; root:xnu-2422.75.4~1/RELEASE_X86_64 x86_64

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Retina display

        A DESCRIPTION OF THE PROBLEM :
        Checkmarks of JCheckBoxMenuItems aren't rendered in high res on Retina displays.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a JFrame with a menu and a selected JCheckBoxMenuItem.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The checkmark should be rendered in high resolution/HiDPI, just like the all other components.
        ACTUAL -
        The checkmark is quite "pixely", rendered in low resolution.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javax.swing.*;

        public class HiDPIJCheckBoxMenuItem {

            public static void main(String[] args) {
                final JFrame frame = new JFrame();
                final JMenuBar bar = new JMenuBar();
                final JMenu menu = new JMenu("Menu");
                final JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem("JCheckBoxMenuItem");
                checkBoxMenuItem.setSelected(true);
                menu.add(checkBoxMenuItem);
                bar.add(menu);
                frame.setJMenuBar(bar);

                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        frame.setBounds(100, 100, 100, 100);
                        frame.setVisible(true);
                    }
                });
            }
        }

        ---------- END SOURCE ----------

          Issue Links

            Activity

            Hide
            alexsch Alexander Scherbatiy (Inactive) added a comment - - edited
            It seems that NSMenuItemSelection is only template that should be processed before drawing.
            ------------------------
                NSImage *image = [NSImage imageNamed:@"NSMenuItemSelection"];
                NSLog(@"is template: %d", [image isTemplate]); // Output: is template: 1
            ------------------------



            See for example NSImageNameMenuOnStateTemplate
            https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/c/data/NSImageNameApplicationIcon
            ------------------------
            Constants that end in the word "Template" name black and clear images that return YES for isTemplate. These images can be processed into variants appropriate for different situations. For example, these images can invert in a selected table view row. See setTemplate:: for more comments. These images are inappropriate for display without further processing, but NSCell and its subclasses will perform the processing.
            ------------------------
            Show
            alexsch Alexander Scherbatiy (Inactive) added a comment - - edited It seems that NSMenuItemSelection is only template that should be processed before drawing. ------------------------     NSImage *image = [NSImage imageNamed:@"NSMenuItemSelection"];     NSLog(@"is template: %d", [image isTemplate]); // Output: is template: 1 ------------------------ See for example NSImageNameMenuOnStateTemplate https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/c/data/NSImageNameApplicationIcon ------------------------ Constants that end in the word "Template" name black and clear images that return YES for isTemplate. These images can be processed into variants appropriate for different situations. For example, these images can invert in a selected table view row. See setTemplate:: for more comments. These images are inappropriate for display without further processing, but NSCell and its subclasses will perform the processing. ------------------------
            Hide
            alexsch Alexander Scherbatiy (Inactive) added a comment -
            The same is for the JTabbedPane arrow icons
            Show
            alexsch Alexander Scherbatiy (Inactive) added a comment - The same is for the JTabbedPane arrow icons
            Hide
            alexsch Alexander Scherbatiy (Inactive) added a comment - - edited
            The solution is to manually retrieve image with double size and high resolution from NSImage.
            Show
            alexsch Alexander Scherbatiy (Inactive) added a comment - - edited The solution is to manually retrieve image with double size and high resolution from NSImage.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/4847877564b9
            User: alexsch
            Date: 2014-03-04 10:03:26 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/4847877564b9 User: alexsch Date: 2014-03-04 10:03:26 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/4847877564b9
            User: lana
            Date: 2014-03-11 04:42:10 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/4847877564b9 User: lana Date: 2014-03-11 04:42:10 +0000

              People

              • Assignee:
                alexsch Alexander Scherbatiy (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: