01: package org.columba.mail.gui.message.viewer;
02:
03: import java.awt.Color;
04: import java.awt.Component;
05: import java.awt.Graphics;
06: import java.awt.Insets;
07:
08: import javax.swing.border.AbstractBorder;
09:
10: public class HeaderSeparatorBorder extends AbstractBorder {
11:
12: protected Color color;
13:
14: public HeaderSeparatorBorder(Color color) {
15: super ();
16:
17: this .color = color;
18: }
19:
20: /**
21: * Paints the border for the specified component with the specified position
22: * and size.
23: *
24: * @param c
25: * the component for which this border is being painted
26: * @param g
27: * the paint graphics
28: * @param x
29: * the x position of the painted border
30: * @param y
31: * the y position of the painted border
32: * @param width
33: * the width of the painted border
34: * @param height
35: * the height of the painted border
36: */
37: public void paintBorder(Component c, Graphics g, int x, int y,
38: int width, int height) {
39: Color oldColor = g.getColor();
40: g.setColor(color);
41: g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
42:
43: g.setColor(oldColor);
44: }
45:
46: /**
47: * Returns the insets of the border.
48: *
49: * @param c
50: * the component for which this border insets value applies
51: */
52: public Insets getBorderInsets(Component c) {
53: return new Insets(0, 0, 1, 0);
54: }
55:
56: /**
57: * Reinitialize the insets parameter with this Border's current Insets.
58: *
59: * @param c
60: * the component for which this border insets value applies
61: * @param insets
62: * the object to be reinitialized
63: */
64: public Insets getBorderInsets(Component c, Insets insets) {
65: insets.left = insets.top = insets.right = insets.bottom = 1;
66: return insets;
67: }
68:
69: }
|