01: /*
02: * @(#)${NAME}
03: *
04: * Copyright 2002 - 2004 JIDE Software Inc. All rights reserved.
05: */
06: package com.jidesoft.plaf.metal;
07:
08: import com.jidesoft.plaf.UIDefaultsLookup;
09: import com.jidesoft.plaf.basic.BasicPainter;
10: import com.jidesoft.plaf.basic.ThemePainter;
11:
12: import javax.swing.*;
13: import javax.swing.plaf.metal.MetalLookAndFeel;
14: import java.awt.*;
15:
16: /**
17: * Painter for Metal L&F.
18: * <p/>
19: * Please note, this class is an internal class which is meant to be used by other JIDE classes only.
20: * Future version might break your build if you use it.
21: */
22: public class MetalPainter extends BasicPainter {
23:
24: private static MetalPainter _instance;
25:
26: public static ThemePainter getInstance() {
27: if (_instance == null) {
28: _instance = new MetalPainter();
29: }
30: return _instance;
31: }
32:
33: public MetalPainter() {
34: }
35:
36: @Override
37: public void paintGripper(JComponent c, Graphics g, Rectangle rect,
38: int orientation, int state) {
39: if (orientation == HORIZONTAL) {
40: MetalBumps bumps = new MetalBumps(
41: rect.width,
42: rect.height - 6,
43: state == ThemePainter.STATE_SELECTED ? MetalLookAndFeel
44: .getPrimaryControlHighlight()
45: : MetalLookAndFeel.getControlHighlight(),
46: state == ThemePainter.STATE_SELECTED ? MetalLookAndFeel
47: .getPrimaryControlDarkShadow()
48: : MetalLookAndFeel.getControlDarkShadow(),
49: state == ThemePainter.STATE_SELECTED ? UIDefaultsLookup
50: .getColor("DockableFrame.activeTitleBackground")
51: : UIDefaultsLookup
52: .getColor("DockableFrame.inactiveTitleBackground"));
53: bumps.paintIcon(null, g, rect.x, rect.y + 3);
54: } else {
55: MetalBumps bumps = new MetalBumps(
56: rect.width - 6,
57: rect.height,
58: state == ThemePainter.STATE_SELECTED ? MetalLookAndFeel
59: .getPrimaryControlHighlight()
60: : MetalLookAndFeel.getControlHighlight(),
61: state == ThemePainter.STATE_SELECTED ? MetalLookAndFeel
62: .getPrimaryControlDarkShadow()
63: : MetalLookAndFeel.getControlDarkShadow(),
64: state == ThemePainter.STATE_SELECTED ? UIDefaultsLookup
65: .getColor("DockableFrame.activeTitleBackground")
66: : UIDefaultsLookup
67: .getColor("DockableFrame.inactiveTitleBackground"));
68: bumps.paintIcon(null, g, rect.x + 3, rect.y);
69: }
70: }
71: }
|