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.metal;
18:
19: import com.l2fprod.common.swing.JTaskPaneGroup;
20: import com.l2fprod.common.swing.plaf.basic.BasicTaskPaneGroupUI;
21:
22: import java.awt.Graphics;
23: import java.awt.Graphics2D;
24: import java.awt.RenderingHints;
25:
26: import javax.swing.JComponent;
27: import javax.swing.border.Border;
28: import javax.swing.plaf.ComponentUI;
29:
30: /**
31: * Metal implementation of the <code>JTaskPaneGroup</code> UI. <br>
32: *
33: * @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a>
34: */
35: public class MetalTaskPaneGroupUI extends BasicTaskPaneGroupUI {
36:
37: public static ComponentUI createUI(JComponent c) {
38: return new MetalTaskPaneGroupUI();
39: }
40:
41: protected void installDefaults() {
42: super .installDefaults();
43: group.setOpaque(false);
44: }
45:
46: protected Border createPaneBorder() {
47: return new MetalPaneBorder();
48: }
49:
50: /**
51: * The border of the taskpane group paints the "text", the "icon",
52: * the "expanded" status and the "special" type.
53: *
54: */
55: class MetalPaneBorder extends PaneBorder {
56:
57: protected void paintExpandedControls(JTaskPaneGroup group,
58: Graphics g, int x, int y, int width, int height) {
59: ((Graphics2D) g).setRenderingHint(
60: RenderingHints.KEY_ANTIALIASING,
61: RenderingHints.VALUE_ANTIALIAS_ON);
62:
63: g.setColor(getPaintColor(group));
64: paintRectAroundControls(group, g, x, y, width, height, g
65: .getColor(), g.getColor());
66: paintChevronControls(group, g, x, y, width, height);
67:
68: ((Graphics2D) g).setRenderingHint(
69: RenderingHints.KEY_ANTIALIASING,
70: RenderingHints.VALUE_ANTIALIAS_OFF);
71: }
72:
73: protected boolean isMouseOverBorder() {
74: return true;
75: }
76: }
77:
78: }
|