Icon in JMenuItem shifted to the right

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Windows 11.

      A DESCRIPTION OF THE PROBLEM :
      Icon is painted shifted to the right, compared to the previous version 17.0.16.

      REGRESSION : Last worked in version 17

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start test snippet on Windows with 17.0.16 and 17.0.17. Observe the differences.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      icon at same position as in 17.0.16
      ACTUAL -
      menu item icon shifted to the right.

      ---------- BEGIN SOURCE ----------
      public class Snippet {
        public static void main(String[] args) throws Exception {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          System.out.println(System.getProperty("java.version"));
          JFrame f = new JFrame();
          JMenu menu = new JMenu("File");
          JMenuItem item = new JMenuItem("Menu Item");
          item.setIcon(UIManager.getIcon("Tree.closedIcon"));
          menu.add(item);
          JMenuBar bar = new JMenuBar();
          bar.add(menu);
          f.setJMenuBar(bar);
          f.setSize(800, 600);
          f.setLocationRelativeTo(null);
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.setVisible(true);
        }
      }
      ---------- END SOURCE ----------

            Assignee:
            Praveen Narayanaswamy
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: