Examples of DemoCalendarRenderingHandler


Examples of org.jdesktop.swingx.plaf.basic.DemoCalendarRenderingHandler

     * @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;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.