private void addWeekNumberLabels ( ) { weekNumberLabels = new ArrayList < JLabel > ( ) ; int weekNumberLabelColumnX = constantFirstWeekNumberLabelCell . x ; int weekNumberLabelWidthInCells = 1 ; int weekNumberLabelHeightInCells = 1 ; for ( int i = 0 ; i < 6 ; ++ i ) { int weekNumberLabelRowY = ( i + constantFirstWeekNumberLabelCell . y ) ; JLabel weekNumberLabel = new JLabel ( ) ; weekNumberLabel . setHorizontalAlignment ( SwingConstants . CENTER ) ; weekNumberLabel . setVerticalAlignment ( SwingConstants . CENTER ) ; weekNumberLabel . setBorder ( new EmptyBorder ( constantWeekNumberLabelInsets ) ) ; weekNumberLabel . setOpaque ( true ) ; weekNumberLabel . setText ( "3" + i ) ; weekNumberLabel . setVisible ( false ) ; CellConstraints constraints = CC . xywh ( weekNumberLabelColumnX , weekNumberLabelRowY , weekNumberLabelWidthInCells , weekNumberLabelHeightInCells ) ; centerPanel . add ( weekNumberLabel , constraints ) ; weekNumberLabels . add ( weekNumberLabel ) ; } setSizeOfWeekNumberLabels ( ) ; }
addWeekNumberLabels This adds a set of 6 week number labels to the calendar panel . The text of these labels is set with locale sensitive week numbers each time that the calendar is redrawn .