* @return
*/
private CalendarRenderingHandler createRenderingHandler() {
// <snip> Custom CalendarRenderingHandler
// use a RenderingHandler which supports adding Highlighters.
DemoCalendarRenderingHandler handler = new DemoCalendarRenderingHandler();
// new style: use highlighter for color config
handler.addHighlighters(new ColorHighlighter(
new DayOfWeekHighlightPredicate(Calendar.SATURDAY),
null, Color.BLUE));
// highlight property is setting opacity to true
Highlighter transparent = new AbstractHighlighter(MonthViewExtDemoUtils.SELECTED) {
@Override
public Component highlight(Component component,
ComponentAdapter adapter) {
// opacity is not one of the properties which are
// guaranteed to be reset, so we have to do it here
((JComponent) component).setOpaque(adapter.getComponent()
.isOpaque());
// call super to apply the highight - which is to
// set the component's opacity to true
return super.highlight(component, adapter);
}
@Override
protected Component doHighlight(Component component,
ComponentAdapter adapter) {
((JComponent) component).setOpaque(true);
return component;
}
};
handler.addHighlighters(transparent);
// </snip>
return handler;
}