JXTitledPanelAddon.java
上传用户:zhengdagz
上传日期:2014-03-06
资源大小:1956k
文件大小:3k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. /*
  2.  * $Id: JXTitledPanelAddon.java,v 1.7 2005/10/13 08:59:58 kleopatra Exp $
  3.  *
  4.  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
  5.  * Santa Clara, California 95054, U.S.A. All rights reserved.
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  20.  */
  21. package org.jdesktop.swingx.plaf;
  22. import java.awt.Color;
  23. import java.util.Arrays;
  24. import java.util.List;
  25. import javax.swing.UIManager;
  26. import javax.swing.plaf.ColorUIResource;
  27. import javax.swing.plaf.metal.MetalLookAndFeel;
  28. import org.jdesktop.swingx.JXTitledPanel;
  29. /**
  30.  * Addon for <code>JXTitledPanel</code>.<br>
  31.  *
  32.  */
  33. public class JXTitledPanelAddon extends AbstractComponentAddon {
  34.   public JXTitledPanelAddon() {
  35.     super("JXTitledPanel");
  36.   }
  37.   @Override
  38.   protected void addBasicDefaults(LookAndFeelAddons addon, List<Object> defaults) {
  39.     super.addBasicDefaults(addon, defaults);
  40.     defaults.addAll(Arrays.asList(new Object[] { 
  41.       JXTitledPanel.uiClassID,
  42.       "org.jdesktop.swingx.plaf.metal.MetalTitledPanelUI",
  43.       "JXTitledPanel.title.font",
  44.       UIManager.getFont("Button.font"),
  45.       "JXTitledPanel.title.foreground", new ColorUIResource(Color.WHITE),
  46.       "JXTitledPanel.title.darkBackground", new ColorUIResource(Color.GRAY),
  47.       "JXTitledPanel.title.lightBackground", new ColorUIResource(Color.LIGHT_GRAY),
  48.     }));
  49.   }
  50.   
  51.   @Override
  52.   protected void addMetalDefaults(LookAndFeelAddons addon, List<Object> defaults) {
  53.     super.addMetalDefaults(addon, defaults);
  54.     if (isPlastic()) {
  55.       defaults.addAll(Arrays.asList(new Object[] { 
  56.         "JXTitledPanel.title.foreground", new ColorUIResource(Color.WHITE),
  57.         "JXTitledPanel.title.darkBackground", new ColorUIResource(Color.GRAY),
  58.         "JXTitledPanel.title.lightBackground", new ColorUIResource(Color.LIGHT_GRAY),
  59.       }));
  60.     } else {
  61.       defaults.addAll(Arrays.asList(new Object[] { 
  62.         "JXTitledPanel.title.foreground", new ColorUIResource(255, 255, 255),
  63.         "JXTitledPanel.title.darkBackground", MetalLookAndFeel.getCurrentTheme().getPrimaryControlDarkShadow(),
  64.         "JXTitledPanel.title.lightBackground", MetalLookAndFeel.getCurrentTheme().getPrimaryControl()
  65.       }));
  66.     }
  67.   }
  68.   @Override
  69.   protected void addWindowsDefaults(LookAndFeelAddons addon, List<Object> defaults) {
  70.     super.addWindowsDefaults(addon, defaults);
  71.     defaults.addAll(Arrays.asList(new Object[] { 
  72.       "JXTitledPanel.title.foreground", new ColorUIResource(255, 255, 255),
  73.       "JXTitledPanel.title.darkBackground", new ColorUIResource(49, 121, 242),
  74.       "JXTitledPanel.title.lightBackground", new ColorUIResource(198, 211, 247),
  75.     }));
  76.   }
  77. }