Background color of the selected item in an uneditable JComboBox

前端 未结 3 468
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 00:20

The background color of the selected item in an uneditable JComboBox is a sort of blue:

\"alt

Is

3条回答
  •  天命终不由人
    2020-12-02 00:58

    Have you tried writing your own, custom, ListCellRenderer?

    When that method is asked to provide a cell-rendering component you get the following arguments:

     public Component getListCellRendererComponent(JList list,
                                                   Object value,
                                                   int index,
                                                   boolean isSelected,
                                                   boolean cellHasFocus) {
    

提交回复
热议问题