001: /*
002: * Copyright (C) 2004 NNL Technology AB
003: * Visit www.infonode.net for information about InfoNode(R)
004: * products and how to contact NNL Technology AB.
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 (at your option) 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,
019: * MA 02111-1307, USA.
020: */
021:
022: // $Id: TabFactory.java,v 1.10 2005/02/16 11:28:15 jesper Exp $
023: package net.infonode.tabbedpanel;
024:
025: import net.infonode.tabbedpanel.titledtab.TitledTab;
026:
027: import javax.swing.*;
028:
029: /**
030: * Factory methods for creating different tabs
031: *
032: * @author $Author: jesper $
033: * @version $Revision: 1.10 $
034: * @see Tab
035: * @see TitledTab
036: */
037: public class TabFactory {
038: private TabFactory() {
039: }
040:
041: /**
042: * Creates a TitledTab with a text and an icon
043: *
044: * @param text the text
045: * @param icon the icon or null for no icon
046: * @return the created TitledTab
047: */
048: public static TitledTab createTitledTab(String text, Icon icon) {
049: return new TitledTab(text, icon, null, null);
050: }
051:
052: /**
053: * Creates a TitledTab with a text, an icon and a content component
054: *
055: * @param text the text
056: * @param icon the icon or null for no icon
057: * @param contentComponent the content component for the tab
058: * @return the created TitledTab
059: */
060: public static TitledTab createTitledTab(String text, Icon icon,
061: JComponent contentComponent) {
062: return new TitledTab(text, icon, contentComponent, null);
063: }
064:
065: /**
066: * Creates a TitledTab with a text, an icon, a title component and a
067: * content component
068: *
069: * @param text the text
070: * @param icon the icon or null for no icon
071: * @param contentComponent the content component for the tab
072: * @param titleComponent the title component for the tab
073: * @return the created TitledTab
074: */
075: public static TitledTab createTitledTab(String text, Icon icon,
076: JComponent contentComponent, JComponent titleComponent) {
077: return new TitledTab(text, icon, contentComponent,
078: titleComponent);
079: }
080:
081: /**
082: * Creates a TitledTab with a text, a different icon for each of the
083: * states, a title component and a content component
084: *
085: * @param text the text
086: * @param icon the icon for the normal state or null for no icon
087: * @param highlightedIcon the icon for the highlighted state or null fo no icon
088: * @param disabledIcon the icon for the disabled state or null for no icon
089: * @param contentComponent the content component for the tab
090: * @param titleComponent the title component for the tab
091: * @return the created TitledTab
092: */
093: public static TitledTab createTitledTab(String text, Icon icon,
094: Icon highlightedIcon, Icon disabledIcon,
095: JComponent contentComponent, JComponent titleComponent) {
096: TitledTab tab = new TitledTab(text, icon, contentComponent,
097: titleComponent);
098: tab.getProperties().getHighlightedProperties().setIcon(
099: highlightedIcon);
100: tab.getProperties().getDisabledProperties().setIcon(
101: disabledIcon);
102: return tab;
103: }
104: }
|