import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.DayOfWeek;
class PlannerTab extends JPanel {
String date;
public PlannerTab() {
}
}
class Clock extends Thread {
String location = "Asia/Seoul";
LocalDate LocalDate;
LocalTime LocalTime;
DateTimeFormatter DateForm,TimeForm;
String NowDate,NowTime;
@Override
public void run() {
DateForm = DateTimeFormatter.ofPattern("yyyy/MM/dd");
GetDate();
while(true) {
LocalTime = LocalTime.now(ZoneId.of(location));
TimeForm = DateTimeFormatter.ofPattern("HH: mm: ss");
NowTime = LocalTime.format(TimeForm);
try {
if(LocalTime.getHour() == 0) {
GetDate();
}
Thread.sleep(125);
}
catch(InterruptedException e) {
return;
}
}
}
public void GetDate() {
LocalDate = LocalDate.now(ZoneId.of(location));
NowDate = LocalDate.format(DateForm);
}
}
class Calendar extends JFrame {
int [] CommonYear = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
LeapYear = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
JPanel DatePanel,YMPanel;
Container cnt;
public Calendar() {
setTitle("캘린더");
setSize(600,400);
setVisible(true);
cnt = getContentPane();
cnt.setLayout(new BorderLayout());
YMPanel = new JPanel();
YMPanel.setBackground(Color.gray);
cnt.add(YMPanel, BorderLayout.NORTH);
DatePanel = CreateDatePanel(1, 5);
cnt.add(DatePanel, BorderLayout.CENTER);
}
public JPanel CreateDatePanel(int year, int month) {
JPanel TemporaryPanel;
TemporaryPanel = new JPanel();
TemporaryPanel.setBackground(Color.DARK_GRAY);
TemporaryPanel.setLayout(new GridLayout(0, 7, 5, 5));
for(int i = 1; i <=7; i++) {
//JPanel
}
for(int i = 1; i <= CommonYear[month-1]; i++) {
JButton TemButton = new JButton();
TemporaryPanel.add(TemButton);
TemButton.setForeground(Color.black);
TemButton.setHorizontalAlignment(SwingConstants.CENTER);
TemButton.setText(i + "일");
TemButton.setOpaque(false);
TemButton.setFont(new Font("Gothic", Font.BOLD , 15));
int DayOfWeekNumber = (new LocalDate(this.year, this.month, i).getDayOfWeek()).getValue();
}
return TemporaryPanel;
}
}
public class Main extends JFrame {
JPanel SouthPanel;
Container cnt;
JTabbedPane tab = new JTabbedPane();
//Vector<Tab> records = new Vector<Tab>();
public Main() {
setTitle("하루 일과 정리");
setSize(500,715);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
cnt = getContentPane();
cnt.setLayout(new BorderLayout());
SouthPanel = new JPanel();
SouthPanel.setBackground(Color.DARK_GRAY);
cnt.add(SouthPanel,BorderLayout.SOUTH);
new Calendar();
}
public static void main(String[] args) {
new Main();
}
}