1 | class HeaderSeparatorBorder extends AbstractBorder {↵ | | 1 | class HeaderSeparatorBorder extends AbstractBorder {↵
|
|
2 | protected Color color;↵ | | 2 | protected Color color;↵
|
|
3 | public HeaderSeparatorBorder(Color color) {↵ | | 3 | public HeaderSeparatorBorder(Color color) {↵
|
4 | super();↵ | | 4 | super();↵
|
|
5 | this.color = color;↵ | | 5 | this.color = color;↵
|
6 | }↵ | | 6 | }↵
|
|
7 | /**↵ | | 7 | /**↵
|
8 | * Paints the border for the specified component with the specified↵ | | 8 | * Paints the border for the specified component with the specified↵
|
9 | * position and size.↵ | | 9 | * position and size.↵
|
10 | * ↵ | | 10 | * ↵
|
11 | * @param c↵ | | 11 | * @param c↵
|
12 | * the component for which this border is being painted↵ | | 12 | * the component for which this border is being painted↵
|
13 | * @param g↵ | | 13 | * @param g↵
|
14 | * the paint graphics↵ | | 14 | * the paint graphics↵
|
15 | * @param x↵ | | 15 | * @param x↵
|
16 | * the x position of the painted border↵ | | 16 | * the x position of the painted border↵
|
17 | * @param y↵ | | 17 | * @param y↵
|
18 | * the y position of the painted border↵ | | 18 | * the y position of the painted border↵
|
19 | * @param width↵ | | 19 | * @param width↵
|
20 | * the width of the painted border↵ | | 20 | * the width of the painted border↵
|
21 | * @param height↵ | | 21 | * @param height↵
|
22 | * the height of the painted border↵ | | 22 | * the height of the painted border↵
|
23 | */↵ | | 23 | */↵
|
24 | public void paintBorder(Component c, Graphics g, int x, int y,↵ | | 24 | public void paintBorder(Component c, Graphics g, int x, int y,↵
|
25 | int width, int height) {↵ | | 25 | int width, int height) {↵
|
26 | Color oldColor = g.getColor();↵ | | 26 | Color oldColor = g.getColor();↵
|
27 | g.setColor(color);↵ | | 27 | g.setColor(color);↵
|
28 | g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);↵ | | 28 | g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);↵
|
|
29 | g.setColor(oldColor);↵ | | 29 | g.setColor(oldColor);↵
|
30 | }↵ | | 30 | }↵
|
|
31 | /**↵ | | 31 | /**↵
|
32 | * Returns the insets of the border.↵ | | 32 | * Returns the insets of the border.↵
|
33 | * ↵ | | 33 | * ↵
|
34 | * @param c↵ | | 34 | * @param c↵
|
35 | * the component for which this border insets value applies↵ | | 35 | * the component for which this border insets value applies↵
|
36 | */↵ | | 36 | */↵
|
37 | public Insets getBorderInsets(Component c) {↵ | | 37 | public Insets getBorderInsets(Component c) {↵
|
38 | return new Insets(0, 0, 1, 0);↵ | | 38 | return new Insets(0, 0, 1, 0);↵
|
39 | }↵ | | 39 | }↵
|
|
40 | /**↵ | | 40 | /**↵
|
41 | * Reinitialize the insets parameter with this Border's current Insets.↵ | | 41 | * Reinitialize the insets parameter with this Border's current Insets.↵
|
42 | * ↵ | | 42 | * ↵
|
43 | * @param c↵ | | 43 | * @param c↵
|
44 | * the component for which this border insets value applies↵ | | 44 | * the component for which this border insets value applies↵
|
45 | * @param insets↵ | | 45 | * @param insets↵
|
46 | * the object to be reinitialized↵ | | 46 | * the object to be reinitialized↵
|
47 | */↵ | | 47 | */↵
|
48 | public Insets getBorderInsets(Component c, Insets insets) {↵ | | 48 | public Insets getBorderInsets(Component c, Insets insets) {↵
|
49 | insets.left = insets.top = insets.right = insets.bottom = 1;↵ | | 49 | insets.left = insets.top = insets.right = insets.bottom = 1;↵
|
50 | return insets;↵ | | 50 | return insets;↵
|
51 | }↵ | | 51 | }↵
|
|
52 | } | | 52 | }
|