java设计的时钟日历
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-06-18 18:52 时钟日历
目录 0 2016-06-18 11:15 时钟日历Eclipse工程
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata
文件 1027612 2016-05-31 20:03 时钟日历Eclipse工程.metadata.bak_0.log
文件 0 2016-03-16 12:21 时钟日历Eclipse工程.metadata.lock
文件 105133 2016-06-18 09:32 时钟日历Eclipse工程.metadata.log
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.mylyn
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.mylyn.taskListIndex
文件 20 2016-03-16 12:22 时钟日历Eclipse工程.metadata.mylyn.taskListIndexsegments.gen
文件 32 2016-03-16 12:22 时钟日历Eclipse工程.metadata.mylyn.taskListIndexsegments_1
文件 250 2016-04-21 16:33 时钟日历Eclipse工程.metadata.mylyn.tasks.xml.zip
目录 0 2016-03-16 12:21 时钟日历Eclipse工程.metadata.mylyncontexts
文件 438 2016-03-16 12:22 时钟日历Eclipse工程.metadata.mylyn
epositories.xml.zip
文件 250 2016-04-24 11:28 时钟日历Eclipse工程.metadata.mylyn asks.xml.zip
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.plugins
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history
文件 411 2016-06-16 20:01 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history 50ee0322bc33001615238f93c74edb6c
文件 4187 2016-06-12 16:14 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history f00efec4753000161dc68be1ca15f57f
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history1
目录 0 2016-06-13 00:59 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history10
目录 0 2016-06-16 23:53 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history11
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history12
文件 2690 2016-06-12 23:55 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history127081473ebb3000161dc68be1ca15f57f
文件 2435 2016-06-12 23:19 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history120a3e141b13000161dc68be1ca15f57f
文件 2697 2016-06-13 00:48 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history12d0366194bd3000161dc68be1ca15f57f
目录 0 2016-06-04 16:33 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history13
目录 0 2016-06-12 00:17 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history14
目录 0 2016-06-11 00:19 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history15
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.metadata.pluginsorg.eclipse.core.resources.history16
............此处省略858个文件信息
package clockWithCalender;
import java.awt.*;
import java.awt.event.*;
import java.util.Calendar;
import javax.swing.*;
class CalendarCal {
String day[];
int year month;
public void setYear(int year) {
this.year = year;
}
public int getYear() {
return year;
}
public void setMonth(int month) {
this.month = month;
}
public int getMonth() {
return month;
}
public String[] getCalendar() {
String day_of_week[] = new String[42];
Calendar c = Calendar.getInstance();
c.set(year month - 1 1);
int weekday = c.get(Calendar.DAY_OF_WEEK) - 1;
int day = 0;
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
day = 31;
}
if (month == 4 || month == 6 || month == 9 || month == 11) {
day = 30;
}
if (month == 2) {
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
day = 29;
} else {
day = 28;
}
}
for (int i = weekday n = 1; i < weekday + day; i++) {
day_of_week[i] = String.valueOf(n);
n++;
}
return day_of_week;
}
}
public class CalendarPanel extends JPanel implements ActionListener {
Calendar c=Calendar.getInstance();
Label labelDay[] = new Label[42];
Label titleName[] = new Label[7];
String name[] = { “日“ “一“ “二“ “三“ “四“ “五“ “六“ };
String day_of_week;
JButton previousMonthnextMonth;
int year = c.get(Calendar.YEAR) month = c.get(Calendar.MONTH)+1
date=c.get(Calendar.DATE)WeekDay=c.get(Calendar.DAY_OF_WEEK)-1;
CalendarCal calendar;
Label showMessage = new Label(““ Label.CENTER);
Label showdate=new Label(““);
public CalendarPanel() {
Panel pCenter = new Panel();
Panel pNorth = new Panel();
Panel pSouth = new Panel();
pCenter.setLayout(new GridLayout(7 7));
for(int i = 0; i < 7; i++)
{
if(i==WeekDay)
day_of_week=name[i];
}
showdate.setText(String.valueOf(year)+“年“+String.valueOf(month)+“月“+String.valueOf(date)+“日“
+“ 星期“+day_of_week);
showdate.setFont(new Font(“Tahoma“ Font.PLAIN30));
for (int i = 0; i < 7; i++) {
titleName[i] = new Label(name[i]Label.CENTER);
titleName[i].setFont(new Font(“Tahoma“ Font.PLAIN50));
pCenter.add(titleName[i]);
}
for (int i = 0; i < 42; i++) {
labelDay[i] = new Label(““ Label.CENTER);
labelDay[i].setFont(new Font(“Tahoma“ Font.PLAIN30));
pCenter.add(labelDay[i]);
}
calendar = new CalendarCal();
calendar.setYear(year);
calendar.setMonth(month);
String day[] = calendar.getCalendar();
for (int i = 0; i < 42; i++) {
labelDay[i].setText(day[i]);
if(String.valueOf(c.get(Calendar.DATE)).equals(day[i]))
labelDay[i].setBackground(Color.blue);;
}
nextMonth = new JButton(new ImageIcon(“image\you.JPG“));
previousMonth = new JButton(new ImageIcon(“image\zuo.JPG“));
nextMonth.addActionListener(this);
previousMonth.addActionList
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-06-18 18:52 时钟日历
目录 0 2016-06-18 11:15 时钟日历Eclipse工程
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
文件 1027612 2016-05-31 20:03 时钟日历Eclipse工程.me
文件 0 2016-03-16 12:21 时钟日历Eclipse工程.me
文件 105133 2016-06-18 09:32 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
文件 20 2016-03-16 12:22 时钟日历Eclipse工程.me
文件 32 2016-03-16 12:22 时钟日历Eclipse工程.me
文件 250 2016-04-21 16:33 时钟日历Eclipse工程.me
目录 0 2016-03-16 12:21 时钟日历Eclipse工程.me
文件 438 2016-03-16 12:22 时钟日历Eclipse工程.me
epositories.xm
文件 250 2016-04-24 11:28 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
文件 411 2016-06-16 20:01 时钟日历Eclipse工程.me
文件 4187 2016-06-12 16:14 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
目录 0 2016-06-13 00:59 时钟日历Eclipse工程.me
目录 0 2016-06-16 23:53 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
文件 2690 2016-06-12 23:55 时钟日历Eclipse工程.me
文件 2435 2016-06-12 23:19 时钟日历Eclipse工程.me
文件 2697 2016-06-13 00:48 时钟日历Eclipse工程.me
目录 0 2016-06-04 16:33 时钟日历Eclipse工程.me
目录 0 2016-06-12 00:17 时钟日历Eclipse工程.me
目录 0 2016-06-11 00:19 时钟日历Eclipse工程.me
目录 0 2016-06-18 11:15 时钟日历Eclipse工程.me
............此处省略858个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)