Background color of Menu is different from that of MenuBar
, 1.4.1_03(Bug ID:2049780)
, 1.4.2(mantis) (Bug ID:2049781)
A licensee found out diffrent view of application between Windows2000
With Windows2000(or older windows), Menu and Menubar have the same background
However, winth WindowsXP, the background color of Menu is different from
that of MenuBar.
Please see the attached JPEG file(diff-color.JPG).
1) Compile the attached sample program(SampleMenu.java)
2) Invoke the Sample program
MPU: Pentium IV 1.4[GHz]
OS : WindowsXP(japanese)
JDK: 1.3.1_01a, 1.4.0-rc-b88
The licensee's environment:
MPU: Pentium II 447[MHz]
OS : WindowsXP(japanese)
- Licensee point out as follows.
- This happnes to most of application which use java.awt.MenuBar class.
- This is caused by the different way how to draw each compoments.
The java.awt.MenuBar uses DrawMenuBar of Win32 API.
The java.awt.MenuItem uses GetSysColor to get COLOR_MENU value,
and java.awt.Menu does also because it is the subclass of MenuItem class.
In other word, Menu and MenuItem class will be drawn by same color.
MenuBar has possibility to be drawn by different color.
- Please see the "workaround" also.
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
customer Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Very standard XP configurations (tested on XP Professional
and XP Home Editions)
A DESCRIPTION OF THE PROBLEM :
Using Windows Look and Feel, the background color of the
Swing menubar and menu items is white on a standard XP
configuration. This white color does not match the
background color of the toolbars (which is beige or
something), but it should. It is inconsistent with other
Apparently the JToolbar is getting the right color, so the
menubar and menu items must not be using the correct
I tried changing the Windows "Display
Properties", "Appearance", "Advanced Appearance", altering
the "Menu" color setting (which was white, to beige), and
that did make the menus appear right, but a user shouldn't
have to do that to make the application have the same
appearance as all of the other Windows applications. (I
don't know why the other standard Windows apps don't pay
attention to this "Menu" color setting, or why the default
This default white background color has one other bad
effect. When the mouse moves over a menu item with a pull-
right/cascade submenu, the right-arrow/triangle indicator
turns white, and disappears into the background!
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the SwingSet2 demo from the J2SDK1.4.0 installation.
2. Look at the color of the menubar and menus, compared to
the color of the JToolbars. They should match (both being
beige, I guess).
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expected the menubar and menu to have normal "Windows"
background colors, but they were white.
This bug can be reproduced always.
(Review ID: 146979)
Setting environment to displaying with "classic style".
Although I do not know well what word is used on each menu or tag
with WindowsXP(english), I will show how to set with XP(Japanese)
- Select [Control Panel]-[System]-[setting]-[performance]
- Click the radio button of "prioritize performance"
(I do not know if the above word is correct or not.)
Then, windows design changes like windows2K and older(win98/Me/NT).
This is not a bug. Because by default on WinXP the menu & menubar colour
are different. Menu has white on WinXP.
To change this,
Settings -> Control Panel -> Display -> Appearance
Select Menu from the Item list and see the colour.
Change this on WinXP to the same colour as MenuBar
The J2SE code uses the variable COLOR_MENU (awt_MenuItem.cpp) to get
the menu colour if it is not selected. This corresponds to the same
colour as in what is set through the control panel.
This is not a bug. Will close this bug once the customer okays my
There is a difference in WinNT and WinXP.
Behaviour on WinNT
If you change the Menu color using Control Panel, the entire menubar
of all applications open and any new applications which comes up
has this color.
Also the dropdown menu for each of the menu items also changes to the
The menubar of Control Panel, Windows explorer all change to the selected
With the testcase, the entire menubar changes to the selected color.
Behaviour on WinXP
If you change the Menu color using Control Panel, for the windows applications,
like Control Panel, Windows explorer, the menubar is still grey but only the
dropdown menu changes to the selected color.
But the testcase comes up with just the MenuItems changed to the selected
colour and the remaining menubar remains grey.
I am not sure which is a bug here. Is it XP or our java application ?
In XP there is a variable COLOR_MENUBAR which controls the colour of
the menubar. Since our binaries are being built on WinNT, this variable
is defined in winuser.h which comes with the latest Visual Studio.NET,
I will have to find a nice way of fixing it.
The fix as mentioned in Suggested fix is not complete. It only works for
'Windows XP Style' (Control Panel->Display)
'Windows Classic Style' still shows different colours in the menubar.
A bug has been filed (4781104) against 'Windows Classic Style'
Submitted On 17-OCT-2002
Don't say this isn't a bug! This is definelty a bug.
You have to make the colors consistant. You can't expect
the end user to change the color in the control panel!
Submitted On 27-NOV-2003
Why is the menu color *white* on XP? no other XP app has a
white menu bar?! IE has a grey menu bar. Explorer, ditto...
same with Word, etc... so: why white?
Also, if you are going to emulate the windows look and feel,
note that XP has a gradient on the menu bar. it goes from
light gray to some kind of dirty grey - not pretty, but it's
PLEASE NOTE: JDK6 is formerly known as Project Mustang