-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
56 lines (45 loc) · 1.36 KB
/
Main.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.io.IOException;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Main{
static TodoList list = new TodoList();
static CalendarView cv;
static TodoListView lv;
static JFrame window;
public static void main(String[] args){
try{
list = FileReader.readData("list.tdl");
}catch(IOException e){
e.printStackTrace();
}
window = new JFrame();
cv = new CalendarView(list);
lv = new TodoListView(list);
window.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.PAGE_START;
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.5;
c.weighty = 1;
c.ipadx = 20;
c.ipady = 40;
window.add(cv,c);
window.add(Box.createHorizontalGlue(), c);
c.weightx = 0.2;
window.add(lv,c);
window.setTitle("To-do List Manager");
window.setExtendedState(JFrame.MAXIMIZED_BOTH);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
}
public static void save(){
try{
FileReader.storeData(list, "list.tdl");
}catch(Exception e){
e.printStackTrace();
}
window.dispose();
main(new String[0]);
}
}