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

Nimbus LAF: disabled JComboBox using renderer has bad font color

    XMLWordPrintable

Details

    • b16
    • x86
    • windows_vista

    Description

      FULL PRODUCT VERSION :
      java version "1.7.0_02-ea"
      Java(TM) SE Runtime Environment (build 1.7.0_02-ea-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 22.0-b04, mixed mode)

      java version "1.6.0_27"
      Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows Vista SP2 x64 [version 6.0.6002]

      A DESCRIPTION OF THE PROBLEM :
      Using Nimbus look and feel, any disabled JComboBox using a custom ListCellRenderer has the enabled font color instead of the disabled one. Others JComboBox components are well shown with disabled colors. Metal look and feel does not have this problem.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. javac DisabledComboTestCase.java
      2. java -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel DisabledComboTestCase

      (java 6:)
      2. java -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel DisabledComboTestCase

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JComboBox on the right (with item "JComboBox with DefaultListCellRenderer") should like the "Simple JComboBox" on the left, including text disabled color.
      ACTUAL -
      The JComboBox on the right ("JComboBox with DefaultListCellRenderer") has the "enabled" text color.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.FlowLayout;

      import javax.swing.DefaultListCellRenderer;
      import javax.swing.JComboBox;
      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      public class DisabledComboTestCase {
      public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable(){
      @Override
      public void run() {
      JComboBox combo = new JComboBox();
      combo.addItem("Simple JComboBox");
      combo.setEnabled(false);

      JComboBox customCombo = new JComboBox();
      customCombo.setRenderer(new DefaultListCellRenderer());
      customCombo.addItem("JComboBox with DefaultListCellRenderer");
      customCombo.setEnabled(false);

      JFrame myFrame = new JFrame();
      myFrame.setLayout(new FlowLayout());
      myFrame.add(combo);
      myFrame.add(customCombo);
      myFrame.pack();
      myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      myFrame.setVisible(true);
      }
      });
      }
      }

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

      Attachments

        Issue Links

          Activity

            People

              dnguyen Damon Nguyen
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: