public class DatePane extends Container
{
DecoBox Box = new DecoBox();
DayTable Table = new DayTable( this);
ActionListener Client;
static String[] Months = {"Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"};
public DatePane ( Date d ) {
add( Box);
add( Table);
setDate( d);
}
public void addActionListener ( ActionListener client ) {
Client = AWTEventMulticaster.add( Client, client);
}
public Date getDate () {
return Table.getDate();
}
public void setDate ( Date dt ) {
String mon = Months[ dt.getMonth()] + ' ' +
Integer.toString( 1900 + dt.getYear());
Box.setText( mon);
Table.setDate( dt);
}
public void doLayout () {
Dimension size = getSize();
Box.setBounds( 0, 0, size.width, size.height);
Table.setBounds( 15, 15, size.width-30, size.height-30);
}
void notifyClients () {
if ( Client != null ) {
ActionEvent e = new ActionEvent( this,
ActionEvent.ACTION_PERFORMED, "select");
Client.actionPerformed( e);
}
}
}