How to set white back ground for disabled combo box???

I already tried setBackground.... But it didnt work like textfields.

Recommended Answers

All 3 Replies

I guess you're using java, you could try comboboxname.setBackGround(Color.blue);hope it helps

Well its java section of the forum.... Secondly i have already tried the method, check my question....

JComboBox has two states EDITABLE and Non-EDITABLE

yes that works as JTextFields, because JComboBox is compound JComponents, you can extract (be sure that is L&F sensitive don9t exxpect that definitions for Metal L&F can works on OS MAC.getSystemLook...) JButton of JTextField

all JComponetns has own Model, and for non-editable Components returns JLabel, for Editable JTextField, and if is there applied some InputMask, Formatter, ValidationMask, then returns JFormattedTextField, you can ignore that for your question, both are same methods for your OP about JComboBox

for editable JComboBox should be harder to start from scratch then

myCombo.getEditor().getEditorComponent().setBackground(...);
((JTextField)myCombo.getEditor().getEditorComponent()).setDisabledTextColor(...);
commented: Mind Blowing.... +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.