-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTitleDark.java
35 lines (29 loc) · 1.01 KB
/
TitleDark.java
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
import java.awt.*;
class TitleDark extends Title{
public TitleDark(String header) {
super(header);
style = ElementFactory.STYLE_DARK;
}
@Override
int show(Graphics2D graphics2D, int hPos) {
this.hPos = hPos;
graphics2D.setFont(DPGenGUI.headerFont);
graphics2D.setColor(textColor);
int alignedPos = getAlignedTextPosition(header, 25, DPGenGUI.width - 50, DPGenGUI.headerFont);
graphics2D.drawString(header, alignedPos, hPos - 7);
graphics2D.setColor(DPGenGUI.thematicColor);
graphics2D.setStroke(new BasicStroke(2));
FontMetrics metrics = graphics2D.getFontMetrics();
graphics2D.drawLine(alignedPos + 5, hPos - 7 + 3, alignedPos + metrics.stringWidth(header), hPos - 7 + 3);
height = 45;
return hPos + height;
}
@Override
Rectangle getSelectionRegion() {
return new Rectangle(10, hPos - 40, DPGenGUI.width - 55, 50);
}
@Override
int getHeight() {
return height;
}
}