-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDietWindow.java
More file actions
66 lines (51 loc) · 2.1 KB
/
DietWindow.java
File metadata and controls
66 lines (51 loc) · 2.1 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package 헬스파트너;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.Map;
public class DietWindow extends JFrame {
private DietPanel dietPanel;
private WeeklyDietPanel weeklyPanel;
private DietDataManager dataManager;
private UIStyleManager styleManager;
public DietWindow() {
setTitle("식단 기록");
setSize(800, 500);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(new BorderLayout());
styleManager = new UIStyleManager();
dataManager = new DietDataManager();
// 로고 패널 추가
add(createLogoPanel(), BorderLayout.NORTH);
// 메인 패널 (식단 입력 + 주간 보고서)
JPanel mainPanel = new JPanel(new GridLayout(1, 2));
mainPanel.setBackground(new Color(18, 18, 18));
// 식단 입력 패널
dietPanel = new DietPanel(styleManager, dataManager, this); // this 추가
// 주간 보고서 패널
weeklyPanel = new WeeklyDietPanel(styleManager, dataManager, this); // this와 dataManager 전달
JScrollPane reportScrollPane = new JScrollPane(weeklyPanel);
reportScrollPane.setBorder(BorderFactory.createLineBorder(Color.WHITE));
mainPanel.add(dietPanel);
mainPanel.add(reportScrollPane);
add(mainPanel, BorderLayout.CENTER);
// 저장된 데이터 로드 및 표시
updateWeeklyReport();
setVisible(true);
}
private JPanel createLogoPanel() {
JPanel logoPanel = new JPanel();
logoPanel.setBackground(new Color(18, 18, 18));
logoPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
JLabel logoLabel = new JLabel("Health Partner");
logoLabel.setFont(new Font("Brush Script MT", Font.BOLD, 28));
logoLabel.setForeground(Color.RED);
logoPanel.add(logoLabel);
return logoPanel;
}
public void updateWeeklyReport() {
Map<String, ArrayList<String>> records = dataManager.loadDietRecords();
weeklyPanel.updateReport(records);
}
}