001 /*
002 * $Id: JXTipOfTheDayAddon.java,v 1.4 2005/10/15 09:55:47 l2fprod Exp $
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 import java.util.List;
026
027 import javax.swing.BorderFactory;
028 import javax.swing.LookAndFeel;
029 import javax.swing.UIManager;
030 import javax.swing.plaf.BorderUIResource;
031 import javax.swing.plaf.ColorUIResource;
032 import javax.swing.plaf.FontUIResource;
033
034 import org.jdesktop.swingx.JXTipOfTheDay;
035 import org.jdesktop.swingx.plaf.basic.BasicTipOfTheDayUI;
036 import org.jdesktop.swingx.plaf.windows.WindowsTipOfTheDayUI;
037
038 /**
039 * Addon for <code>JXTipOfTheDay</code>.<br>
040 *
041 * @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a>
042 */
043 public class JXTipOfTheDayAddon extends AbstractComponentAddon {
044
045 public JXTipOfTheDayAddon() {
046 super("JXTipOfTheDay");
047 }
048
049 @Override
050 protected void addBasicDefaults(LookAndFeelAddons addon, List<Object> defaults) {
051 defaults.add(JXTipOfTheDay.uiClassID);
052 defaults.add(BasicTipOfTheDayUI.class.getName());
053
054 defaults.add("TipOfTheDay.font");
055 Font font = UIManager.getFont("TextPane.font");
056 if (font == null) {
057 font = new Font("Serif", Font.PLAIN, 12);
058 }
059 defaults.add(new FontUIResource(font));
060
061 defaults.add("TipOfTheDay.tipFont");
062 font = UIManager.getFont("Label.font");
063 if (font == null) {
064 font = new Font("Dialog", Font.PLAIN, 12);
065 }
066 font = font.deriveFont(Font.BOLD, 13f);
067 defaults.add(new FontUIResource(font));
068
069 defaults.add("TipOfTheDay.background");
070 defaults.add(new ColorUIResource(Color.white));
071
072 defaults.add("TipOfTheDay.icon");
073 defaults.add(LookAndFeel.makeIcon(BasicTipOfTheDayUI.class,
074 "resources/TipOfTheDay24.gif"));
075
076 defaults.add("TipOfTheDay.border");
077 defaults.add(new BorderUIResource(BorderFactory.createLineBorder(new Color(
078 117, 117, 117))));
079
080 addResource(defaults,
081 "org.jdesktop.swingx.plaf.basic.resources.TipOfTheDay");
082 }
083
084 @Override
085 protected void addWindowsDefaults(LookAndFeelAddons addon,
086 List<Object> defaults) {
087 super.addWindowsDefaults(addon, defaults);
088
089 defaults.add(JXTipOfTheDay.uiClassID);
090 defaults.add(WindowsTipOfTheDayUI.class.getName());
091
092 defaults.add("TipOfTheDay.background");
093 defaults.add(new ColorUIResource(128, 128, 128));
094
095 defaults.add("TipOfTheDay.font");
096 Font font = UIManager.getFont("Label.font");
097 if (font == null) {
098 font = new Font("Dialog", Font.PLAIN, 12);
099 }
100 font = font.deriveFont(13f);
101 defaults.add(new FontUIResource(font));
102
103 defaults.add("TipOfTheDay.icon");
104 defaults.add(LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class,
105 "resources/tipoftheday.png"));
106
107 defaults.add("TipOfTheDay.border");
108 defaults
109 .add(new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));
110
111 addResource(defaults,
112 "org.jdesktop.swingx.plaf.windows.resources.TipOfTheDay");
113 }
114
115 }