intmaxDay=calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,day>maxDay?maxDay:day);
updateView();
}
});
JPanelyearMonthPanel=newJPanel();
cPane.add(yearMonthPanel,BorderLayout.NORTH);
yearMonthPanel.setLayout(newBorderLayout());
yearMonthPanel.add(newJPanel(),BorderLayout.CENTER);
JPanelyearPanel=newJPanel();
yearMonthPanel.add(yearPanel,BorderLayout.WEST);
yearPanel.setLayout(newBorderLayout());
yearPanel.add(yearsLabel,BorderLayout.WEST);
yearPanel.add(yearsSpinner,BorderLayout.CENTER);
monthsLabel=newJLabel("Month:");
monthsComboBox=newJComboBox();
for(inti=1;i<=12;i++){
monthsComboBox.addItem(newInteger(i));
}
monthsComboBox.setSelectedIndex(calendar.get(Calendar.MONTH));
monthsComboBox.addActionListener(newActionListener(){
publicvoidactionPerformed(ActionEventactionEvent){
intday=calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,1);
calendar.set(Calendar.MONTH,monthsComboBox.getSelectedIndex());
intmaxDay=calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,day>maxDay?maxDay:day);
updateView();
}
});
JPanelmonthPanel=newJPanel();
yearMonthPanel.add(monthPanel,BorderLayout.EAST);
monthPanel.setLayout(newBorderLayout());
monthPanel.add(monthsLabel,BorderLayout.WEST);
monthPanel.add(monthsComboBox,BorderLayout.CENTER);
daysModel=newAbstractTableModel(){
publicintgetRowCount(){
return7;
}
publicintgetColumnCount(){
return7;
}
publicObjectgetValueAt(introw,intcolumn){
if(row==0){