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