2012-02-17 1 views
1

JComboBox의 팝업/선택 부분의 테두리를 변경하지 않겠습니다.JComboBox의 팝업 섹션의 테두리를 어떻게 변경합니까?

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

를하지만 나에게이 준 : enter image description here

과 :

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

을하지만 준 UI 내가 해봤

BasicComboBoxUI

입니다

주 나 : enter image description here

나는 이것과 같은 것이 아니다. (포토샵에서 행해졌 다.) enter image description here 정확하지 않다면 상관 없다. 나는 그저 비슷하지 않다.

누구든지이 작업을 수행하는 방법에 대한 아이디어가 있습니까? 이 같은

+0

좋은 질문 한 – mKorbel

답변

2

뭔가 작동합니다

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

와우, 그것은 내가 한 가지를 (편집보고) – Russell

+0

FWIW, 내가 setBorder()를 호출했다 변화 번 근무 BasicComboPopup에 자체에 - 목록에 없습니다. – stacktracer

관련 문제