01: package com.jidesoft.plaf.xerto;
02:
03: import com.jidesoft.plaf.UIDefaultsLookup;
04:
05: import javax.swing.*;
06: import javax.swing.border.Border;
07: import javax.swing.plaf.UIResource;
08: import java.awt.*;
09:
10: /**
11: * FrameBorder - Simple single line border with small drop shadow
12: *
13: * @author Created by Jasper Potts (21-Jun-2004)
14: * @version 1.0
15: */
16: public class FrameBorder implements Border, UIResource {
17:
18: private static final Insets INSETS = new Insets(1, 1, 3, 3);
19:
20: /**
21: * Returns the insets of the border.
22: *
23: * @param c the component for which this border insets value applies
24: */
25: public Insets getBorderInsets(Component c) {
26: return INSETS;
27: }
28:
29: /**
30: * Returns whether or not the border is opaque. If the border is opaque, it is responsible for filling in it's own
31: * background when painting.
32: */
33: public boolean isBorderOpaque() {
34: return false;
35: }
36:
37: /**
38: * Paints the border for the specified component with the specified position and size.
39: *
40: * @param c the component for which this border is being painted
41: * @param g the paint graphics
42: * @param x the x position of the painted border
43: * @param y the y position of the painted border
44: * @param width the width of the painted border
45: * @param height the height of the painted border
46: */
47: public void paintBorder(Component c, Graphics g, int x, int y,
48: int width, int height) {
49: g.setColor(XertoUtils.getFrameBorderColor());
50: g.drawLine(x, y, x + width - 3, y);
51: g.drawLine(x, y, x, y + height - 3);
52: g.drawLine(x + width - 3, y, x + width - 3, y + height - 3);
53: g.drawLine(x, y + height - 3, x + width - 3, y + height - 3);
54: g.setColor(XertoUtils.getControlColor());
55: g.fillRect(x + width - 2, y, 2, 2);
56: g.fillRect(x, y + height - 2, 2, 2);
57: g.setColor(XertoUtils.getControlMidShadowColor());
58: g.drawLine(x + width - 2, y + 1, x + width - 2, y + height - 2);
59: g
60: .drawLine(x + 1, y + height - 2, x + width - 2, y
61: + height - 2);
62: g.setColor(XertoUtils.getControlLightShadowColor());
63: g.drawLine(x + width - 1, y + 2, x + width - 1, y + height - 1);
64:
65: if ("DockableFrameUI".equals(((JComponent) c).getUIClassID())
66: && c.getParent().getComponentCount() > 1) {
67: g.setColor(UIDefaultsLookup
68: .getColor("JideTabbedPane.selectedTabBackground"));
69: g.drawLine(x + 2, y + height - 1, x + width - 2, y + height
70: - 1);
71: } else {
72: g.setColor(XertoUtils.getControlLightShadowColor());
73: g.drawLine(x + 2, y + height - 1, x + width - 1, y + height
74: - 1);
75: }
76:
77: }
78: }
|