java万年历拓展成日志记事本 下载本文

String 星期[]={\星期日\星期一\星期二\星期三\星期四\星期五\星期六\JPanel leftPanel,rightPanel;

public CalendarPad(int year,int month,int day) {

super(\日历记事本-by Jackbase\leftPanel=new JPanel(); JPanel leftCenter=new JPanel(); JPanel leftNorth=new JPanel();

leftCenter.setLayout(new GridLayout(7,7));

rightPanel=new JPanel(); this.year=year;

this.month=month; this.day=day;

负责改变年=new Year(this); 负责改变年.setYear(year); 负责改变月=new Month(this); 负责改变月.setMonth(month);

title=new JLabel[7];

showDay=new JTextField[42]; for(int j=0;j<7;j++) {

title[j]=new JLabel();

title[j].setText(星期[j]);

title[j].setBorder(BorderFactory.createRaisedBevelBorder()); leftCenter.add(title[j]); }

title[0].setForeground(Color.red); title[6].setForeground(Color.blue); for(int i=0;i<42;i++) {

showDay=new JTextField(); showDay.addMouseListener(this); showDay.setEditable(false); leftCenter.add(showDay);

}

calendar=Calendar.getInstance(); Box box=Box.createHorizontalBox(); box.add(负责改变年); box.add(负责改变月); leftNorth.add(box);

leftPanel.setLayout(new BorderLayout()); leftPanel.add(leftNorth,BorderLayout.NORTH); leftPanel.add(leftCenter,BorderLayout.CENTER);

leftPanel.add(new Label(\请在年份输入框输入所查年份(负数表示公元前),并回车确定\BorderLayout.SOUTH) ;