setLayout(new BorderLayout());
Calendar d = new GregorianCalendar();
yy = d.get(Calendar.YEAR);
mm = d.get(Calendar.MONTH);
dd = d.get(Calendar.DAY_OF_MONTH);
add(cal = new Cal(yy, mm, dd), BorderLayout.NORTH);
p = new Panel();
p.setLayout(new FlowLayout());
// The action for changing yy or mm draws a new calendar
p.add(yyText = new TextField(""+yy));
yyText.addActionListener(this);
p.add(mmText = new TextField(""+(mm+1)));
mmText.addActionListener(this);
// The action for changing the day just highlights that day.
p.add(ddText = new TextField(""+dd));
ddText.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
cal.setDayActive(Integer.parseInt(ddText.getText()));
}
});
add(p, BorderLayout.SOUTH);