001    /*
002     * $Id: HeaderAddon.java 2474 2007-11-21 17:32:04Z kschaefe $
003     *
004     * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005     * Santa Clara, California 95054, U.S.A. All rights reserved.
006     *
007     * This library is free software; you can redistribute it and/or
008     * modify it under the terms of the GNU Lesser General Public
009     * License as published by the Free Software Foundation; either
010     * version 2.1 of the License, or (at your option) any later version.
011     *
012     * This library is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015     * Lesser General Public License for more details.
016     *
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this library; if not, write to the Free Software
019     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
020     */
021    package org.jdesktop.swingx.plaf;
022    
023    import java.awt.Color;
024    import java.awt.Font;
025    
026    import javax.swing.LookAndFeel;
027    import javax.swing.UIManager;
028    import javax.swing.plaf.ColorUIResource;
029    import javax.swing.plaf.FontUIResource;
030    
031    import org.jdesktop.swingx.JXHeader;
032    
033    /**
034     * Addon for <code>JXHeader</code>.<br>
035     *
036     */
037    public class HeaderAddon extends AbstractComponentAddon {
038    
039        public HeaderAddon() {
040            super("JXHeader");
041        }
042    
043        /**
044         * {@inheritDoc}
045         */
046        @Override
047        protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
048            super.addBasicDefaults(addon, defaults);
049            
050            defaults.add(JXHeader.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicHeaderUI");
051            //TODO image is missing
052            defaults.add("JXHeader.defaultIcon",
053                    LookAndFeel.makeIcon(HeaderAddon.class, "basic/resources/header-default.png"));
054            //TODO use safe methods
055            defaults.add("JXHeader.titleFont", new FontUIResource(UIManager.getFont("Label.font").deriveFont(Font.BOLD)));
056            defaults.add("JXHeader.titleForeground", UIManager.getColor("Label.foreground"));
057            defaults.add("JXHeader.descriptionFont", UIManager.getFont("Label.font"));
058            defaults.add("JXHeader.descriptionForeground", UIManager.getColor("Label.foreground"));
059            defaults.add("JXHeader.background",
060                    UIManagerExt.getSafeColor("control", new ColorUIResource(Color.decode("#C0C0C0"))));
061            defaults.add("JXHeader.startBackground", new ColorUIResource(Color.WHITE));
062        }
063    
064        /**
065         * {@inheritDoc}
066         */
067        @Override
068        protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
069            super.addMacDefaults(addon, defaults);
070            
071            defaults.add("JXHeader.background", new ColorUIResource(new Color(218, 218, 218)));
072            defaults.add("JXHeader.startBackground", new ColorUIResource(new Color(235, 235, 235)));
073        }
074    
075        /**
076         * {@inheritDoc}
077         */
078        @Override
079        protected void addNimbusDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
080            super.addNimbusDefaults(addon, defaults);
081            
082            defaults.add("JXHeader.background", new ColorUIResource(new Color(214, 217, 223, 255)));
083        }
084    }