1
|
|
package abbot.editor.widgets;
|
2
|
|
|
3
|
|
import java.awt.*;
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
public class Highlighter extends AbstractComponentDecorator {
|
9
|
|
private static final float WIDTH = 2;
|
10
|
|
private static final Color BASE = Color.red;
|
11
|
|
private static final Color COLOR =
|
12
|
|
new Color(BASE.getRed(), BASE.getGreen(), BASE.getBlue(), 64);
|
13
|
0
|
public Highlighter(Component c) {
|
14
|
0
|
super(c instanceof Container ? (Container)c : c.getParent());
|
15
|
|
}
|
16
|
0
|
public void paint(Graphics graphics) {
|
17
|
0
|
Component c = getComponent();
|
18
|
0
|
Graphics2D g = (Graphics2D)graphics;
|
19
|
0
|
g.setColor(COLOR);
|
20
|
0
|
g.setStroke(new BasicStroke(WIDTH));
|
21
|
0
|
g.drawRect(Math.round(0 + WIDTH/2),
|
22
|
|
Math.round(0 + WIDTH/2),
|
23
|
|
Math.round(c.getWidth()-WIDTH),
|
24
|
|
Math.round(c.getHeight()-WIDTH));
|
25
|
0
|
g.fillRect(Math.round(0 + WIDTH/2),
|
26
|
|
Math.round(0 + WIDTH/2),
|
27
|
|
Math.round(c.getWidth()-WIDTH),
|
28
|
|
Math.round(c.getHeight()-WIDTH));
|
29
|
|
}
|
30
|
|
}
|
31
|
|
|