001/*
002 * $Id: TipOfTheDayAddon.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 */
021package org.jdesktop.swingx.plaf;
022
023import java.awt.Color;
024import java.awt.Font;
025
026import javax.swing.BorderFactory;
027import javax.swing.LookAndFeel;
028import javax.swing.plaf.BorderUIResource;
029import javax.swing.plaf.ColorUIResource;
030import javax.swing.plaf.FontUIResource;
031
032import org.jdesktop.swingx.JXTipOfTheDay;
033import org.jdesktop.swingx.plaf.basic.BasicTipOfTheDayUI;
034import org.jdesktop.swingx.plaf.windows.WindowsTipOfTheDayUI;
035
036/**
037 * Addon for <code>JXTipOfTheDay</code>.<br>
038 * 
039 * @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a>
040 */
041public class TipOfTheDayAddon extends AbstractComponentAddon {
042
043  public TipOfTheDayAddon() {
044    super("JXTipOfTheDay");
045  }
046
047  @Override
048  protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
049      super.addBasicDefaults(addon, defaults);
050      
051      Font font = UIManagerExt.getSafeFont("Label.font", new Font("Dialog", Font.PLAIN, 12));
052      font = font.deriveFont(Font.BOLD, 13f);
053      
054      defaults.add(JXTipOfTheDay.uiClassID, BasicTipOfTheDayUI.class.getName());
055      defaults.add("TipOfTheDay.font", UIManagerExt.getSafeFont("TextPane.font",
056                new FontUIResource("Serif", Font.PLAIN, 12)));
057      defaults.add("TipOfTheDay.tipFont", new FontUIResource(font));
058      defaults.add("TipOfTheDay.background", new ColorUIResource(Color.WHITE));
059      defaults.add("TipOfTheDay.icon",
060              LookAndFeel.makeIcon(BasicTipOfTheDayUI.class, "resources/TipOfTheDay24.gif"));
061      defaults.add("TipOfTheDay.border", new BorderUIResource(
062              BorderFactory.createLineBorder(new Color(117, 117, 117))));
063
064    UIManagerExt.addResourceBundle(
065            "org.jdesktop.swingx.plaf.basic.resources.TipOfTheDay");
066  }
067
068  /**
069   * {@inheritDoc}
070   */
071  @Override
072  protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
073    super.addWindowsDefaults(addon, defaults);
074
075    Font font = UIManagerExt.getSafeFont("Label.font",
076            new Font("Dialog", Font.PLAIN, 12));
077    font = font.deriveFont(13f);
078    
079    defaults.add(JXTipOfTheDay.uiClassID, WindowsTipOfTheDayUI.class.getName());
080    defaults.add("TipOfTheDay.background", new ColorUIResource(Color.GRAY));
081    defaults.add("TipOfTheDay.font", new FontUIResource(font));
082    defaults.add("TipOfTheDay.icon",
083            LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class, "resources/tipoftheday.png"));
084    defaults.add("TipOfTheDay.border" ,new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));
085
086    UIManagerExt.addResourceBundle(
087        "org.jdesktop.swingx.plaf.windows.resources.TipOfTheDay");
088  }
089
090}