private void labelMonthIndicatorMousePressed ( MouseEvent e ) { // Skip this function if the settings have not been applied. if ( settings == null ) { return ; } // If the month menu is disabled, then return. if ( settings . getEnableMonthMenu ( ) == false ) { return ; } // Create and show the month popup menu. JPopupMenu monthPopupMenu = new JPopupMenu ( ) ; String [ ] allLocalMonths = settings . getTranslationArrayStandaloneLongMonthNames ( ) ; for ( int i = 0 ; i < allLocalMonths . length ; ++ i ) { final String localMonth = allLocalMonths [ i ] ; final int localMonthZeroBasedIndexTemp = i ; if ( ! localMonth . isEmpty ( ) ) { monthPopupMenu . add ( new JMenuItem ( new AbstractAction ( localMonth ) { int localMonthZeroBasedIndex = localMonthZeroBasedIndexTemp ; @ Override public void actionPerformed ( ActionEvent e ) { drawCalendar ( displayedYearMonth . getYear ( ) , Month . of ( localMonthZeroBasedIndex + 1 ) ) ; } } ) ) ; } } Point menuLocation = getMonthOrYearMenuLocation ( labelMonth , monthPopupMenu ) ; monthPopupMenu . show ( monthAndYearInnerPanel , menuLocation . x , menuLocation . y ) ; }
labelMonthIndicatorMousePressed This event is called any time that the user clicks on the month display label in the calendar . This opens a menu that the user can use to select a new month in the same year .