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: TabbedUIDefaults.java,v 1.15 2005/08/29 12:18:41 johan Exp $
023: package net.infonode.tabbedpanel;
024:
025: import net.infonode.gui.UIManagerUtil;
026: import net.infonode.util.ColorUtil;
027:
028: import javax.swing.*;
029: import java.awt.*;
030:
031: /**
032: * Methods for retrieving UI defaults for the current "Look and Feel" from the
033: * UIManager. The values are adapted to be used with classes in the TabbedPanel package.
034: *
035: * @author $Author: johan $
036: * @version $Revision: 1.15 $
037: */
038: public class TabbedUIDefaults {
039: private static final int BUTTON_ICON_SIZE = 11;
040:
041: private TabbedUIDefaults() {
042: }
043:
044: /**
045: * Gets the content area background color
046: *
047: * @return a copy of the color
048: */
049: public static Color getContentAreaBackground() {
050: return UIManagerUtil.getColor("Panel.background", "control",
051: Color.LIGHT_GRAY);
052: }
053:
054: /**
055: * Gets the tab normal state foreground color
056: *
057: * @return a copy of the color
058: */
059: public static Color getNormalStateForeground() {
060: return UIManagerUtil.getColor("TabbedPane.foreground",
061: "controlText", Color.BLACK);
062: }
063:
064: /**
065: * Gets the tab normal state background color
066: *
067: * @return a copy of the color
068: */
069: public static Color getNormalStateBackground() {
070: return UIManagerUtil.getColor("TabbedPane.background",
071: "control", Color.LIGHT_GRAY);
072: }
073:
074: /**
075: * Gets the tab highlighted state foreground color
076: *
077: * @return a copy of the color
078: */
079: public static Color getHighlightedStateForeground() {
080: return getNormalStateForeground();
081: }
082:
083: /**
084: * Gets the tab highlighted state backgound color
085: *
086: * @return a copy of the color
087: */
088: public static Color getHighlightedStateBackground() {
089: return UIManagerUtil.getColor("Panel.background", "control",
090: Color.LIGHT_GRAY);
091: }
092:
093: /**
094: * Gets the tab disabled state foreground color
095: *
096: * @return a copy of the color
097: */
098: public static Color getDisabledForeground() {
099: return UIManagerUtil.getColor("inactiveCaptionText",
100: "controlText", Color.WHITE);
101: }
102:
103: /**
104: * Gets the tab disabled state background color
105: *
106: * @return a copy of the color
107: */
108: public static Color getDisabledBackground() {
109: return ColorUtil.mult(getNormalStateBackground(), 0.9);
110: }
111:
112: /**
113: * Gets the (border) dark shadow color
114: *
115: * @return a copy of the color
116: */
117: public static Color getDarkShadow() {
118: return UIManagerUtil.getColor("TabbedPane.darkShadow",
119: "controlDkShadow", Color.BLACK);
120: }
121:
122: /**
123: * Gets the (border) highlight color
124: *
125: * @return a copy of the color
126: */
127: public static Color getHighlight() {
128: return UIManagerUtil.getColor("TabbedPane.highlight",
129: "controlHighlight", Color.WHITE);
130: }
131:
132: /**
133: * Gets the font
134: *
135: * @return a copy of the font
136: */
137: public static Font getFont() {
138: return UIManagerUtil.getFont("TabbedPane.font");
139: }
140:
141: /**
142: * Gets the icon text gap
143: *
144: * @return the icon text gap
145: */
146: public static int getIconTextGap() {
147: return UIManager.getInt("TabbedPane.textIconGap");
148: }
149:
150: /**
151: * Gets the tab insets
152: *
153: * @return a copy of the insets
154: */
155: public static Insets getTabInsets() {
156: return UIManagerUtil.getInsets("TabbedPane.tabInsets",
157: new Insets(2, 2, 0, 2));
158: }
159:
160: /**
161: * Gets the insets for the content area
162: *
163: * @return a copy of the insets
164: */
165: public static Insets getContentAreaInsets() {
166: return UIManagerUtil.getInsets(
167: "TabbedPane.contentBorderInsets",
168: new Insets(2, 2, 2, 2));
169: }
170:
171: /**
172: * Gets the default icon size for buttons
173: *
174: * @return icon size in pixels
175: */
176: public static int getButtonIconSize() {
177: return BUTTON_ICON_SIZE;
178: }
179: }
|