JDK-6531437 : vista: Swing menu bar doesn't look and feel like that of a native app
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2007-03-06
  • Updated: 2011-02-16
  • Resolved: 2007-03-30
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6000]

A DESCRIPTION OF THE PROBLEM :
Under Vista, the Swing menu bar looks and behaves somewhat differently from native applications running on the same OS.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the sample application.  Run Notepad alongside for the purpose of comparison.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1. The menu background colour should be blueish with a gradient.
2. Menu items being hovered over should be highlighted in a light blue.
3. Clicking on a disabled menu item should not hide the menu.

ACTUAL -
1. The menu background colour is flat grey.
2. Menu items being hovered over are highlighted in a deep blue.
3. Clicking on a disabled menu item hides the menu.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;

public class Test {
    public void main(String[] args) throws Exception {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
        JFrame frame = new JFrame("Title");
        JMenuBar menuBar = new JMenuBar();
        JMenu fileMenu = new JMenu("File");
        JMenuItem disabledMenuItem = new JMenuItem("Disabled");
        disabledMenuItem.setEnabled(false);
        fileMenu.add(disabledMenuItem);
        menuBar.add(fileMenu);
        frame.setJMenuBar(menuBar);
        frame.setSize(400, 300);
        frame.setVisible(true);
    }
}

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