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.blue;
18:
19: import com.l2fprod.common.swing.plaf.ButtonBarButtonUI;
20: import com.l2fprod.common.swing.plaf.basic.BasicButtonBarUI;
21:
22: import java.awt.Color;
23:
24: import javax.swing.AbstractButton;
25: import javax.swing.BorderFactory;
26: import javax.swing.JButton;
27: import javax.swing.JComponent;
28: import javax.swing.UIManager;
29: import javax.swing.border.Border;
30: import javax.swing.border.CompoundBorder;
31: import javax.swing.plaf.BorderUIResource;
32: import javax.swing.plaf.ColorUIResource;
33: import javax.swing.plaf.ComponentUI;
34: import javax.swing.plaf.UIResource;
35:
36: /**
37: * BlueishButtonBarUI. <br>
38: *
39: */
40: public class BlueishButtonBarUI extends BasicButtonBarUI {
41:
42: public static ComponentUI createUI(JComponent c) {
43: return new BlueishButtonBarUI();
44: }
45:
46: protected void installDefaults() {
47: Border b = bar.getBorder();
48: if (b == null || b instanceof UIResource) {
49: bar.setBorder(new BorderUIResource(new CompoundBorder(
50: BorderFactory.createLineBorder(UIManager
51: .getColor("controlDkShadow")),
52: BorderFactory.createEmptyBorder(1, 1, 1, 1))));
53: }
54:
55: Color color = bar.getBackground();
56: if (color == null || color instanceof ColorUIResource) {
57: bar.setOpaque(true);
58: bar.setBackground(new ColorUIResource(Color.white));
59: }
60: }
61:
62: public void installButtonBarUI(AbstractButton button) {
63: button.setUI(new BlueishButtonBarButtonUI());
64: button.setHorizontalTextPosition(JButton.CENTER);
65: button.setVerticalTextPosition(JButton.BOTTOM);
66: button.setOpaque(false);
67: }
68:
69: static class BlueishButtonBarButtonUI extends BlueishButtonUI
70: implements ButtonBarButtonUI {
71: }
72:
73: }
|