JComboBox drop down list border color
When we click arrow button of JComboBox we get drop down list with black colored border.
But I want to set border of dropdown list to grey color.
How to do that?
When we click arrow button of JComboBox we get drop down list with black colored border.
But I want to set border of dropdown list to grey color.
How to do that?
The required border size and color is mentioned in javax.swing.plaf.basic.BasicComboPopup
instantiated in javax.swing.plaf.basic.BasicComboBoxUI
; and unfortunately that is not directly accessible.
One of the approach would be:
1. subclass BasicComboPopup - here you'll simply set the derived class's border to desired one.
2. subclass BasicComboBoxUI - here you'll override createPopup (to return derived BasicComboPopup object) and createUI (to return derived BasicComboBoxUI object)
3. make a call to target JComboBox's setUI to set new instance of derived BasicComboBoxUI object.
Caution:
1. This approach will be implementation specific, for more generalized result try creating your own look and feel.
2. May need to tweek some more code to get final output.