일부 사용자 선택에 따라 스크롤 막대의 색상을 변경해야한다는 요구 사항이 있습니다. 색상 코드가 처음으로 제대로 포착되어 무엇 일프로그래밍 방식으로 스크롤 막대 색상 변경
@Override
protected void beforeTopic(final Form f) {
int scrollColor=0x000000;
switch(userSelectedTopic)
{
case 1:
scrollColor=0x59be8a;
break;
case 2:
scrollColor = 0xff3333;
break;
.
.
.
}
// setting color to scroll thumb
Style s = UIManager.getInstance().getComponentStyle("ScrollThumb");
System.out.println(scrollColor);
s.setFgColor(scrollColor);
s.setBgColor(scrollColor);
s.setBgTransparency(255);
UIManager.getInstance().setComponentStyle("ScrollThumb", s);
s = UIManager.getInstance().getComponentStyle("ScrollThumb");
System.out.println("-->>"+s.getFgColor());
}
: 전형적인 형태에서, 나는 내가 사용 스크롤 막대의 색상을 설정하고있다 스위치 케이스가 있습니다. 이 양식을 다른 사용자 선택으로 다시 호출하면 switch 문에 따라 색상 코드 값이 변경됩니다. 스타일 속성도 변경됩니다.
그러나 엄지 손가락에 적용된 초기 색상이 우선합니다!
무슨 문제가 될 수 있을까?
시도해 보았습니다. f.refreshTheme(); 그러나 이것은 효과가없는 것 같습니다. 그냥 처음 적용된 색상을 유지합니다.