-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArticleDark.java
More file actions
46 lines (41 loc) · 1.48 KB
/
ArticleDark.java
File metadata and controls
46 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.awt.*;
import java.util.Vector;
class ArticleDark extends Article{
public ArticleDark(Vector<String> article) {
super(article);
style = ElementFactory.STYLE_DARK;
backgroundColor = ElementFactory.DEFAULT_DARK_STYLE_BACKGROUND_COLOR.brighter();
}
@Override
int show(Graphics2D graphics2D, int hPos) {
this.hPos = hPos;
graphics2D.setColor(backgroundColor);
graphics2D.setStroke(new BasicStroke(2));
graphics2D.fillRect(10, hPos - 20, DPGenGUI.width - 20, article.size() * 24 + 2);
if (bordered) {
Stroke lastStroke = graphics2D.getStroke();
graphics2D.setStroke(new BasicStroke(4));
graphics2D.setColor(Color.BLACK);
graphics2D.drawRect(8, hPos - 22, DPGenGUI.width - 16, article.size() * 24 + 6);
graphics2D.setStroke(lastStroke);
}
graphics2D.setFont(DPGenGUI.textFont);
graphics2D.setColor(textColor);
for (String line : article) {
graphics2D.drawString(line, getAlignedTextPosition(line, 10, DPGenGUI.width - 10, DPGenGUI.textFont), hPos);
hPos += 24;
}
hPos += 25;
height = hPos - this.hPos - 25 + 4;
if (height < 20) height += 24;
return hPos;
}
@Override
Rectangle getSelectionRegion() {
return new Rectangle(5, hPos - 25, DPGenGUI.width - 20, height + 10);
}
@Override
int getHeight() {
return height + 20;
}
}