符号怎么改?
import java.awt.*;import java.awt.event.*;
import java.beans.*;
import
import java.util.*;
public class Calendar1 extends Panel implements Serializable,ActionListener
{
protected Date date;
protected GregorianCalendar calendar;
protected Panel header=null;
protected Panel body=null;
protected Button prevMonth,nextMonth;
protected Label monthLabel;
protected String days=new String("星期天星期一星期二星期三星期四星期五星期六");
protected String months=new String("一月二月三月四月五月六月七月八月九月十月十一月十二月");
public Calendar1()
{
calendar=new GregorianCalendar();
setSize(200,200);
setLayout(new BorderLayout());
header=new Panel();
prevMonth=new Button("<<");
prevMonth.addActionListener(this);
nextMonth=new Button(">>");
nextMonth.addActionListener(this);
header.add(prevMonth);
monthLabel=new Label(null,Label.CENTER);
header.add(monthLabel);
header.add(nextMonth);
add("北方",header);
body=new Panel();
body.setLayout(new GridLayout(0,7));
for(int i=0;i<21;i+=3)
{
body.add(new Label(days.substring(i,i+3),Label.CENTER));
}
add("中间",body);
displayCalendar();
}
public synchronized Date getDate()
{
return calendar.getTime();
}
public synchronized void setDate(Date date)
{
calendar.setTime(date);
displayCalendar();
}
protected synchronized void displayCalendar()
{
int yearNum=calendar.get(Calendar.YEAR);
int monthNum=calendar.get(Calendar.MONTH);
int dayNum=calendar.get(Calendar.DATE);
String monthStr=months.substring(monthNum*3,monthNum*3+3);
monthLabel.setText(monthStr+" " +yearNum);
monthLabel.repaint();
while(body.getComponentCount()>7)
body.remove(7);
calendar.set(Calendar.DATE,1);
date=calendar.getTime();
int day=date.getDay();
for(int i=0;i<day;i++)
{
body.add(new Label());
}
Button dayBtn;
for(int i=1;i<=32;i++)
{
dayBtn=new Button(new Integer(i).toString());
dayBtn.addActionListener(this);
body.add(dayBtn);
calendar.add(Calendar.DATE,1);
if(i==dayNum)
dayBtn.requestFocus();
if(calendar.get(Calendar.DATE)<=1)
break;
}
calendar.set(yearNum,monthNum,dayNum);
body.validate();
}
public synchronized void actionPerformed(ActionEvent e)
{
if(e.getSource()==prevMonth||e.getSource()==nextMonth)
{
calendar.set(Calendar.DATE,1);
calendar.add(Calendar.MONTH,e.getSource()==prevMonth?-1:1);
displayCalendar();
}
else
{
calendar.set(Calendar.DATE,Integer.parseInt(((Button)e.getSource()).getLabel()));
}
EventQueue.getEventQueue().postEvent(new MouseEvent(this,MouseEvent.MOUSE_CLICKED,0,0,0,0,1,true));
}
}