-
Notifications
You must be signed in to change notification settings - Fork 1
/
TimeDisplay.java
33 lines (27 loc) · 881 Bytes
/
TimeDisplay.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
import javax.swing.*;
import java.awt.*;
import java.time.LocalDateTime;
public class TimeDisplay extends DisplayDecorator {
private final Display displayComponent;
private LabelPanel labelPanel;
public TimeDisplay(Display display, int width, int height) {
super(width, height);
this.displayComponent = display;
}
@Override
public JPanel create() {
JPanel panel = new Panel().create(displayComponent, getWidth(), getHeight());
labelPanel = new LabelPanel();
panel.add(labelPanel.createPanel(getWidth(), super.getHeight()));
return panel;
}
@Override
public void show() {
displayComponent.show();
labelPanel.updateText("시간: " + LocalDateTime.now());
}
@Override
public int getHeight() {
return displayComponent.getHeight() + super.getHeight();
}
}