001: /*
002: * CloseTabContentPanel.java
003: *
004: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021:
022: package org.underworldlabs.swing.plaf;
023:
024: import java.awt.BorderLayout;
025: import java.awt.Color;
026: import java.awt.Component;
027: import javax.swing.BorderFactory;
028: import javax.swing.JPanel;
029: import javax.swing.JTabbedPane;
030: import javax.swing.UIManager;
031: import javax.swing.border.Border;
032:
033: /* ----------------------------------------------------------
034: * CVS NOTE: Changes to the CVS repository prior to the
035: * release of version 3.0.0beta1 has meant a
036: * resetting of CVS revision numbers.
037: * ----------------------------------------------------------
038: */
039:
040: /**
041: *
042: * @author Takis Diakoumis
043: * @version $Revision: 1.4 $
044: * @date $Date: 2006/05/14 06:56:07 $
045: */
046: public class CloseTabContentPanel extends JPanel {
047:
048: /** the highlight border width */
049: private static final int BORDER_WIDTH = 4;
050:
051: /** The added tab panel border */
052: private static Border border;
053:
054: /** the active color for the tab border */
055: private static Color activeColor;
056:
057: /** the displayed component */
058: private Component component;
059:
060: /** the associated menu item */
061: private TabMenuItem tabMenuItem;
062:
063: /** Creates a new instance of CloseTabContentPanel */
064: public CloseTabContentPanel(int tabPlacement, Component component) {
065: super (new BorderLayout());
066:
067: this .component = component;
068:
069: if (activeColor == null) {
070: activeColor = UIManager
071: .getColor("InternalFrame.activeTitleBackground");
072: }
073:
074: if (border == null) {
075: switch (tabPlacement) {
076: case JTabbedPane.TOP:
077: border = BorderFactory.createMatteBorder(BORDER_WIDTH,
078: 0, 0, 0, activeColor);
079: break;
080: case JTabbedPane.BOTTOM:
081: border = BorderFactory.createMatteBorder(0, 0,
082: BORDER_WIDTH, 0, activeColor);
083: break;
084: }
085: }
086: add(component, BorderLayout.CENTER);
087: setBorder(border);
088: }
089:
090: public Component getDisplayComponent() {
091: return component;
092: }
093:
094: public TabMenuItem getTabMenuItem() {
095: return tabMenuItem;
096: }
097:
098: public void setTabMenuItem(TabMenuItem tabMenuItem) {
099: this.tabMenuItem = tabMenuItem;
100: }
101:
102: }
|