01: /**
02: * L2FProd.com Common Components 7.3 License.
03: *
04: * Copyright 2005-2007 L2FProd.com
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package com.l2fprod.common.swing.plaf;
18:
19: import com.l2fprod.common.swing.JOutlookBar;
20: import com.l2fprod.common.swing.border.FourLineBorder;
21: import com.l2fprod.common.swing.plaf.basic.BasicOutlookButtonUI;
22: import com.l2fprod.common.swing.plaf.windows.WindowsOutlookBarUI;
23:
24: import java.awt.Color;
25: import java.util.Arrays;
26: import java.util.List;
27:
28: import javax.swing.BorderFactory;
29: import javax.swing.SwingConstants;
30: import javax.swing.UIManager;
31: import javax.swing.border.Border;
32: import javax.swing.border.CompoundBorder;
33:
34: /**
35: * JOutlookBarAddon. <br>
36: *
37: */
38: public class JOutlookBarAddon extends AbstractComponentAddon {
39:
40: public JOutlookBarAddon() {
41: super ("JOutlookBar");
42: }
43:
44: protected void addBasicDefaults(LookAndFeelAddons addon,
45: List defaults) {
46: Color barBackground = new Color(167, 166, 170);
47:
48: // border for the bar and the tab buttons
49: Border outlookBarButtonBorder;
50: Border outlookBarBorder;
51: {
52: Color background = UIManager.getColor("Button.background");
53: if (background == null) {
54: // try control
55: background = UIManager.getColor("control");
56: }
57: if (background == null) {
58: background = new Color(238, 238, 238);
59: }
60: Color color1 = background.brighter();
61: Color color2 = background.darker();
62:
63: outlookBarButtonBorder = new WindowsOutlookBarUI.WindowsTabButtonBorder(
64: color1, color2);
65: outlookBarButtonBorder = new CompoundBorder(
66: outlookBarButtonBorder, BorderFactory
67: .createEmptyBorder(3, 3, 3, 3));
68:
69: outlookBarBorder = new FourLineBorder(color2, color2,
70: color1, color1);
71: }
72:
73: // border for buttons inside a JOutlookBar
74: Border outlookButtonBorder;
75: {
76: Color color1 = barBackground.brighter();
77: Color color2 = barBackground.darker();
78:
79: outlookButtonBorder = new BasicOutlookButtonUI.OutlookButtonBorder(
80: color1, color2);
81: outlookButtonBorder = new CompoundBorder(
82: outlookButtonBorder, BorderFactory
83: .createEmptyBorder(3, 3, 3, 3));
84: }
85:
86: defaults.addAll(Arrays.asList(new Object[] {
87: JOutlookBar.UI_CLASS_ID,
88: WindowsOutlookBarUI.class.getName(), "OutlookButtonUI",
89: BasicOutlookButtonUI.class.getName(),
90: "OutlookBar.background", barBackground,
91: "OutlookBar.border", outlookBarBorder,
92: "OutlookBar.tabButtonBorder", outlookBarButtonBorder,
93: "OutlookButton.border", outlookButtonBorder,
94: "OutlookBar.tabAlignment",
95: new Integer(SwingConstants.CENTER), }));
96: }
97:
98: }
|