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: TabbedPanePanel.java 2050 2010-12-09 15:31:45Z dmsmith $
21   */
22  package org.crosswire.common.swing.desktop;
23  
24  import java.awt.Insets;
25  import java.awt.LayoutManager;
26  
27  import javax.swing.JPanel;
28  import javax.swing.UIManager;
29  
30  import org.crosswire.common.swing.GuiUtil;
31  
32  /**
33   * A JPanel class where it's child components will paint on top of its border.
34   * 
35   * @see gnu.lgpl.License for license details.<br>
36   *      The copyright to this program is held by it's authors.
37   * @author Willie Thean [williethean at yahoo dot com]
38   */
39  public class TabbedPanePanel extends JPanel {
40      public TabbedPanePanel() {
41          super();
42          init();
43      }
44  
45      public TabbedPanePanel(boolean isDoubleBuffered) {
46          super(isDoubleBuffered);
47          init();
48      }
49  
50      public TabbedPanePanel(LayoutManager layout) {
51          super(layout);
52          init();
53      }
54  
55      public TabbedPanePanel(LayoutManager layout, boolean isDoubleBuffered) {
56          super(layout, isDoubleBuffered);
57          init();
58      }
59  
60      private void init() {
61          this.setBorder(UIManager.getBorder("TabbedPanePanel.border"));
62          GuiUtil.applyDefaultOrientation(this);
63      }
64  
65      /**
66       * If we setBorder on this JPanel, the border width will be part of the
67       * insets. We return an insets of 0 so the child components will paint on
68       * top of the border.
69       */
70      @Override
71      public Insets getInsets() {
72          return new Insets(0, 0, 0, 0);
73      }
74  
75      /**
76       * Serialization ID
77       */
78      private static final long serialVersionUID = 5254437923545591019L;
79  }
80