1 | private Border innerBorder;↵ | | 1 | private Border innerBorder;↵
|
2 | ↵ | | |
|
3 | private Icon icon;↵ | | 2 | private Icon icon;↵
|
4 | ↵ | | |
|
5 | private Insets insets;↵ | | 3 | private Insets insets;↵
|
6 | ↵ | | |
|
7 | private int spacing;↵ | | 4 | private int spacing;↵
|
8 | ↵ | | |
|
9 | ↵ | | |
|
10 | public IconifiedBorder(Border innerBorder, Icon icon, int spacing) {↵ | | 5 | public IconifiedBorder(Border innerBorder, Icon icon, int spacing) {↵
|
11 | this.innerBorder = innerBorder;↵ | | 6 | this.innerBorder = innerBorder;↵
|
12 | this.icon = icon;↵ | | 7 | this.icon = icon;↵
|
13 | this.spacing = spacing;↵ | | 8 | this.spacing = spacing;↵
|
14 | }↵ | | 9 | }↵
|
15 | ↵ | | |
|
16 | ↵ | | |
|
17 | public void setIcon(Icon ico) {↵ | | 10 | public void setIcon(Icon ico) {↵
|
18 | this.icon = ico;↵ | | 11 | this.icon = ico;↵
|
19 | insets = null;↵ | | 12 | insets = null;↵
|
20 | }↵ | | 13 | }↵
|
21 | ↵ | | |
|
22 | ↵ | | |
|
23 | public Border getInnerBorder() {↵ | | 14 | public Border getInnerBorder() {↵
|
24 | return innerBorder;↵ | | 15 | return innerBorder;↵
|
25 | }↵ | | 16 | }↵
|
|
26 | public void paintBorder(Component c, Graphics g, int x, int y, ↵ | | 17 | public void paintBorder(Component c, Graphics g, int x, int y,↵
|
27 | int width, int height) {↵ | | 18 | int width, int height) {↵
|
28 | innerBorder.paintBorder(c, g, x, y, width, height);↵ | | 19 | innerBorder.paintBorder(c, g, x, y, width, height);↵
|
29 | Insets innerInsets = innerBorder.getBorderInsets(c);↵ | | 20 | Insets innerInsets = innerBorder.getBorderInsets(c);↵
|
30 | iconBounds.x = x + innerInsets.left + spacing;↵ | | 21 | iconBounds.x = x + innerInsets.left + spacing;↵
|
31 | iconBounds.y = y + innerInsets.top + spacing;↵ | | 22 | iconBounds.y = y + innerInsets.top + spacing;↵
|
32 | icon.paintIcon(c, g, iconBounds.x, iconBounds.y) | | 23 | icon.paintIcon(c, g, iconBounds.x, iconBounds.y)
|