private void addMonth ( int i ) { Calendar cal = Calendar . getInstance ( ) ; cal . set ( getDisplayYear ( ) , getDisplayMonth ( ) - 1 , 1 ) ; int month = cal . get ( Calendar . MONTH ) + 1 ; if ( i > 0 && month == 12 ) { addYear ( 1 ) ; } if ( i < 0 && month == 1 ) { addYear ( - 1 ) ; } cal . add ( Calendar . MONTH , i ) ; monthTextField . setText ( String . valueOf ( cal . get ( Calendar . MONTH ) + 1 ) ) ; }
Add month count to month field