int cellHeight = height / CELLROWS;
graph.setColor(CalendarSettings.BACKGROUNDCOLOR);
graph.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int startDateOfWeek = settings.getStartDay();
DateExt temp = currentDate.clone();
temp.setDay(1);
int monthStartDateOfWeek = DateUtils.dayOfWeekToCurrent(temp.getDayOfWeek(), startDateOfWeek);
actualMonthStartCell = monthStartDateOfWeek + CELLCOLUMNS - 1;
int x = monthStartDateOfWeek;
int y = 1;
if (monthStartDateOfWeek == 1) {
y++;
actualMonthStartCell = CELLCOLUMNS * 2;
}
int daysInMonth = currentDate.getDaysInMonth();
actualMonthEndCell = actualMonthStartCell + daysInMonth;
if(mouseDownSelection!=null){
int selectedIndex=getIndexOfCell(mouseDownSelection.x, mouseDownSelection.y);
if(selectedIndex>actualMonthEndCell || selectedIndex<actualMonthStartCell){
mouseDownSelection=null;
}
}
drawHeader(graph);
graph.setColor(colorSeparatorLine);
graph.fillRect(5, cellHeight - 2, width - 10, 2);
for (int dayCounter = 1; dayCounter <= daysInMonth; dayCounter++) {
boolean selected = false;
if (temp.getDate().equals(currentSelectedDate.getDate())) {
selected = true;
}
drawDay(graph, temp, null, x, y, true, selected);
x++;
if (x > 7) {
x = 1;
y++;
}
temp.addDay(1);
}
drawPreviousMonth(graph);
drawNextMonth(graph);
}