1   /**
2    * Distribution License:
3    * JSword is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU Lesser General Public License, version 2.1 as published by
5    * the Free Software Foundation. This program is distributed in the hope
6    * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU Lesser General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *       http://www.gnu.org/copyleft/lgpl.html
12   * or by writing to:
13   *      Free Software Foundation, Inc.
14   *      59 Temple Place - Suite 330
15   *      Boston, MA 02111-1307, USA
16   *
17   * Copyright: 2005
18   *     The copyright to this program is held by it's authors.
19   *
20   * ID: $Id: WindowsLFCustoms.java 2050 2010-12-09 15:31:45Z dmsmith $
21   */
22  package org.crosswire.common.swing.plaf;
23  
24  import java.awt.Color;
25  
26  import javax.swing.BorderFactory;
27  import javax.swing.UIManager;
28  import javax.swing.border.Border;
29  import javax.swing.border.LineBorder;
30  
31  /**
32   * Customizations to Windows LF for tabs.
33   * 
34   * @see gnu.lgpl.License for license details.<br>
35   *      The copyright to this program is held by it's authors.
36   * @author Willie Thean [williethean at yahoo dot com]
37   */
38  public class WindowsLFCustoms extends AbstractLFCustoms {
39      /**
40       * Default constructor.
41       */
42      public WindowsLFCustoms() {
43          super();
44      }
45  
46      /**
47       * Install Windows platform specific UI defaults.
48       */
49      @Override
50      protected void initPlatformUIDefaults() {
51          Border tabbedPanePanelBorder = null;
52          Color standardBorderColor = null;
53          Object windowsScrollPaneborder = UIManager.get("ScrollPane.border");
54          if (windowsScrollPaneborder != null) {
55              if (windowsScrollPaneborder instanceof LineBorder) {
56                  standardBorderColor = ((LineBorder) windowsScrollPaneborder).getLineColor();
57                  tabbedPanePanelBorder = new LineBorder(standardBorderColor);
58              } else {
59                  tabbedPanePanelBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1);
60              }
61          }
62  
63          Border panelSelectBorder = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, standardBorderColor), BorderFactory
64                  .createEmptyBorder(5, 5, 5, 5));
65  
66          Object[] windowsUIDefaults = new Object[] {
67                  "BibleViewPane.TabbedPaneUI", WindowsBorderlessTabbedPaneUI.createUI(null),
68                  "TabbedPanePanel.border", tabbedPanePanelBorder,
69                  "StandardBorder.color", standardBorderColor,
70                  "SelectPanel.border", panelSelectBorder
71          };
72  
73          UIManager.getDefaults().putDefaults(windowsUIDefaults);
74      }
75  }
76