void (boolean selected) { boolean notifyListener = selected != mySelected; mySelected = selected; TextAttributes attributes = updateComponentText(selected); myBorder.setColor(myColorsProvider.getBorderColor(selected)); myBackgroundColor = attributes.getBackgroundColor(); if (notifyListener && myListener != null) { myListener.stateChanged(); } }