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

Selected JMenu not painted properly in Vista L&F if menu is lightweight

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 6u12
    • Fix Version/s: None
    • Component/s: client-libs

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.0.6001]

      A DESCRIPTION OF THE PROBLEM :
      The selection of a JMenu in another JMenu is not painted properly if the JMenu is fold out and an arbitrary item of the embedded JMenu is selected. This problem does only occur with Windows (Vista) L&F and lightweight JMenus. A small part of the selection is painted above the embedded JMenu (see "Error" menu item in provided test case)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This issue can be reproduced with every Swing based application that uses the Windows L&F on Vista and has JMenus embedded into other JMenus.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expected painting of the menus should look equal to native Vista applications.
      ACTUAL -
      A small part of the selection of the JMenu (at the right or the left, depending on where the embedded JMenu is fold out) is painted above the embedded JMenu.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JFrame;
      import javax.swing.JMenu;
      import javax.swing.JMenuBar;
      import javax.swing.JMenuItem;
      import javax.swing.SwingUtilities;
      import javax.swing.UIManager;

      public class Test extends JFrame {

      public Test() {

      //JPopupMenu.setDefaultLightWeightPopupEnabled(false);

      JMenuBar mb = new JMenuBar();
      JMenu m1 = new JMenu("Test");
      m1.add(new JMenuItem("Test"));
      m1.add(new JMenuItem("Test"));

      JMenu m2 = new JMenu("Error");
      m2.add(new JMenuItem("Test"));
      m2.add(new JMenuItem("Test"));
      m2.add(new JMenuItem("Test"));

      m1.add(m2);
      mb.add(m1);

      setJMenuBar(mb);

      setSize(200, 200);
      setLocationRelativeTo(null);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setVisible(true);
      }

      public static void main(String[] args) throws Exception {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
      new Test();
      }
      });
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      make popups heavyweight

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rupashka Pavel Porvatov (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: