private void drawDay(GC gc,int item,int[] days,int columnWidth,int rowHeight){
  Color tempBackground=null;
  Color tempForeground=null;
  boolean validSelection=isValidSelection(item);
  if (validSelection && (item == selection)) {
    tempBackground=gc.getBackground();
    tempForeground=gc.getForeground();
    gc.setBackground(selectionBackgroundColor);
    gc.setForeground(SELECTION_FOREGROUND);
    int height=rowHeight;
    int width=columnWidth;
    int x=columnWidth * (item % 7);
    if (x > 0) {
      x++;
      width--;
    }
    int y=rowHeight * (item / 7 + 1) + 1;
    height--;
    if (y == rowHeight) {
      y++;
      height--;
    }
    gc.fillRectangle(x,y,width,height);
    gc.setBackground(tempBackground);
  }
  String dayString=String.valueOf(days[item]);
  Point position=getDayPosition(gc,item,days,columnWidth,rowHeight);
  gc.drawText(dayString,position.x,position.y,SWT.DRAW_TRANSPARENT);
  if (validSelection && (item == selection)) {
    gc.setForeground(tempForeground);
  }
}

private void drawDay ( GC gc , int item , int [ ] days , int columnWidth , int rowHeight ) { Color tempBackground = null ; Color tempForeground = null ; boolean validSelection = isValidSelection ( item ) ; if ( validSelection && ( item == selection ) ) { tempBackground = gc . getBackground ( ) ; tempForeground = gc . getForeground ( ) ; gc . setBackground ( selectionBackgroundColor ) ; gc . setForeground ( SELECTION_FOREGROUND ) ; int height = rowHeight ; int width = columnWidth ; int x = columnWidth * ( item % 7 ) ; if ( x > 0 ) { x ++ ; width -- ; } int y = rowHeight * ( item / 7 + 1 ) + 1 ; height -- ; if ( y == rowHeight ) { y ++ ; height -- ; } gc . fillRectangle ( x , y , width , height ) ; gc . setBackground ( tempBackground ) ; } String dayString = String . valueOf ( days [ item ] ) ; Point position = getDayPosition ( gc , item , days , columnWidth , rowHeight ) ; gc . drawText ( dayString , position . x , position . y , SWT . DRAW_TRANSPARENT ) ; if ( validSelection && ( item == selection ) ) { gc . setForeground ( tempForeground ) ; } }
draws a day on the canvas .
