JDK-6540844 : GTK LAF: Disabled ComboBox Text and Background is not greyed out
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u2
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris
  • CPU: sparc
  • Submitted: 2007-03-30
  • Updated: 2011-01-19
  • Resolved: 2010-05-20
Related Reports
Relates :  
Description
On GTK LAF the disabled JComboBox is different with 6u2 b01. 

1. The Text is not greyed out

2. The background color is also remains same. 

It should be greyed out completely as in 7.0. 

Run the following code, note that text of the selected item in the JComboBox look enabled, not greyed out. 

import java.awt.*;
import javax.swing.*;

public class DisabledComboBox{
    
    public static void main(String args[]) {
        try {
            UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
        }catch(Exception e){
            e.printStackTrace();
        };
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JComboBox jComboBox1 = new JComboBox();
                jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Disable Combo", "Item1", "Item2"}));
                jComboBox1.setEnabled(false);
                JFrame test = new JFrame("Combo Text");
                test.add(jComboBox1, BorderLayout.SOUTH);
                test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                test.setSize(300, 200);
                test.setLocationRelativeTo(null);
                test.setVisible(true);
            }
        });
    }
}

Comments
EVALUATION Works properly in JDK7b92.
20-05-2010