如何更改JComboBox弹出部分的边框?

我不想改变JComboBox的弹出/选择部分的边框。

请注意,UI是BasicComboBoxUI

我试过了:

weaponCB.setRenderer(new DefaultListCellRenderer() { @Override public void paint(Graphics g) { setBorder(whiteBorder) //whiteBorder is a white border super.paint(g); } }); 

但它给了我这个: 在此处输入图像描述

和:

  for (int i=0; i<weaponCB.getComponentCount(); i++) { if (weaponCB.getComponent(i) instanceof AbstractButton) { ((AbstractButton)weaponCB.getComponent(i)).setBorder(whiteBorder); } } 

但它给了我这个: 在此处输入图像描述

我不想是这样的:(它是在photoshop中完成的) 在此处输入图像描述 我不介意它是不是完全相同,我只是不相似。

有没有人对如何做到这一点有任何想法?

像这样的东西有效:

 Object child = comboBox.getAccessibleContext().getAccessibleChild(0); BasicComboPopup popup = (BasicComboPopup)child; JList list = popup.getList(); list.setBorder( whiteBorder );