JDK-4337049 : Background color on JComboBox also changes color of drop down button
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-05-10
  • Updated: 2000-09-15
  • Resolved: 2000-09-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
1.4.0 betaFixed

Name: rlT66838			Date: 05/10/2000

java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

Setting the background color of a JComboBox also changes the color of the drop
down button in JDK 1.3. This makes the JComboBox look really ugly. This problem
did not exist in JDK 1.2.2.

For some reason, using the "Windows" look and feel with background of the
JComboBox set to Color.white works fine (i.e, the drop down button is grey as
usual), but any other color will change the color of the button.

Example code (tested with 1.3 and 1.2.2):

/* Test background color on JComboBox */

import javax.swing.*;
import java.util.*;
import java.awt.*;
    public class Test extends JFrame
        public Test()
            Vector data = new Vector();
            data.add("Row 1");
            data.add("Row 2");
            JComboBox comboWhite = new JComboBox(data);
            JComboBox comboOtherColor = new JComboBox(data);
            JPanel panel = new JPanel();

      private static final String LOOKANDFEEL = "Windows";
 //   private static final String LOOKANDFEEL = "Metal";

    private void initLookAndFeel()
	    String lookAndFeel = null;

	    if (LOOKANDFEEL != null) {
    	    if (LOOKANDFEEL.equals("Metal")) {
	            lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
            else if (LOOKANDFEEL.equals("Windows")) {
    	        lookAndFeel= "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
        try {
	    } catch (Exception e) {
	        System.err.println("Error LookAndFeel!");
	        System.err.println("Using the default look and feel.");
    public static void main(String[] args)
        Test test = new Test();
        test.setSize(new java.awt.Dimension(200,200));
(Review ID: 104675) 

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin FIXED IN: merlin-beta INTEGRATED IN: merlin-beta

EVALUATION This regression was introduced because of the fix for 4264926. That bug was reporting the oposite of this bug in that for the Metal LAF, changing the fg and bg colors should change the colors of all the components. This should have been restricted to metal only. Easy solution: The foreground and background PropertyChangeHandler should be moved from BasicComboBoxUI to MetalComboBoxUI. mark.davidson@Eng 2000-05-15