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

faulty JMenu repaint with d3d

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • 9
    • 8u45
    • client-libs
    • 2d
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode)

      java version "1.8.0_20"
      Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
      Java HotSpot(TM) Client VM (build 25.20-b23, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Display driver:
         VMware SVGA 3D (Microsoft Corporation - WDDM)
      running in VMWare player:
          6.0.6 build-2700073

      A DESCRIPTION OF THE PROBLEM :
      Created an JFrame application with a standard JMenu.
      The menu entries don't repaint correctly when hovering over them.
      it looks like the redraw area is triangulated and some trangles fail to paint. They stay gray.



      REGRESSION. Last worked in version 8u20

      ADDITIONAL REGRESSION INFORMATION:
      Doesn't seem to happen in a Windows7 VMware player with Java8u45

      does seem to happen with Windows8.1 VMware player with Java8u20
      does seem to happen with Windows8.1 VMware player with Java8u45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      started the application using:

      start /b jre\bin\javaw.exe -Xms512M -Xmx1250M ...

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      expect correctly highlighted and repainted menu items when hovering over them
      ACTUAL -
      triangulation repaint problem when hovering over the menu items

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       Java Swing, 2nd Edition
       By Marc Loy, Robert Eckstein, Dave Wood, James Elliott, Brian Cole
       ISBN: 0-596-00408-7
       Publisher: O'Reilly
       */
      // MenuExample.java
      // A simple example of constructing and using menus.
      //

      import java.awt.BorderLayout;
      import java.awt.Dimension;
      import java.awt.event.ActionEvent;

      import javax.swing.AbstractAction;
      import javax.swing.Icon;
      import javax.swing.ImageIcon;
      import javax.swing.JFrame;
      import javax.swing.JMenu;
      import javax.swing.JMenuBar;
      import javax.swing.JMenuItem;
      import javax.swing.JPanel;
      import javax.swing.JTextPane;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;
      import javax.swing.border.BevelBorder;

      public class MenuExample extends JPanel {

        public JTextPane pane;

        public JMenuBar menuBar;

        public MenuExample() {
          menuBar = new JMenuBar();
          JMenu formatMenu = new JMenu("Justify");
          formatMenu.setMnemonic('J');

          MenuAction leftJustifyAction = new MenuAction("Left", new ImageIcon(
                  "1.gif"));
          MenuAction rightJustifyAction = new MenuAction("Right", new ImageIcon(
                  "2.gif"));
          MenuAction centerJustifyAction = new MenuAction("Center",
                  new ImageIcon("3.gif"));
          MenuAction fullJustifyAction = new MenuAction("Full", new ImageIcon(
                  "4.gif"));

          JMenuItem item;
          item = formatMenu.add(leftJustifyAction);
          item.setMnemonic('L');
          item = formatMenu.add(rightJustifyAction);
          item.setMnemonic('R');
          item = formatMenu.add(centerJustifyAction);
          item.setMnemonic('C');
          item = formatMenu.add(fullJustifyAction);
          item.setMnemonic('F');

          menuBar.add(formatMenu);
          menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));

        }

        class MenuAction extends AbstractAction {

          public MenuAction(String text, Icon icon) {
            super(text, icon);
          }

          public void actionPerformed(ActionEvent e) {
            try {
              pane.getStyledDocument().insertString(0,
                      "Action [" + e.getActionCommand() + "] performed!\n",
                      null);
            } catch (Exception ex) {
              ex.printStackTrace();
            }
          }
        }

        public static void main(String s[]) {

          try {
            // Set System L&F
            UIManager.setLookAndFeel(
                    UIManager.getSystemLookAndFeelClassName());
          } catch (UnsupportedLookAndFeelException e) {
            // handle exception
          } catch (ClassNotFoundException e) {
            // handle exception
          } catch (InstantiationException e) {
            // handle exception
          } catch (IllegalAccessException e) {
            // handle exception
          }

          MenuExample example = new MenuExample();
          example.pane = new JTextPane();
          example.pane.setPreferredSize(new Dimension(250, 250));
          example.pane.setBorder(new BevelBorder(BevelBorder.LOWERED));

          JFrame frame = new JFrame("Menu Example");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setJMenuBar(example.menuBar);
          frame.getContentPane().add(example.pane, BorderLayout.CENTER);
          frame.pack();
          frame.setVisible(true);
        }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      start the application using the vm flag: -Dsun.java2d.d3d=false

      start /b jre\bin\javaw.exe -Dsun.java2d.d3d=false -Xms512M -Xmx1250M ...

            vadim Vadim Pakhnushev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: