question: public void openPopup ( ) { if ( settings == null ) { return ; } if ( ! isEnabled ( ) ) { return ; } if ( ! dateTextField . hasFocus ( ) ) { dateTextField . requestFocusInWindow ( ) ; } LocalDate selectedDateForCalendar = lastValidDate ; DatePicker thisDatePicker = this ; calendarPanel = new CalendarPanel ( thisDatePicker ) ; if ( selectedDateForCalendar != null ) { calendarPanel . setSelectedDate ( selectedDateForCalendar ) ; } popup = new CustomPopup ( calendarPanel , SwingUtilities . getWindowAncestor ( this ) , this , settings . getBorderCalendarPopup ( ) ) ; int defaultX = toggleCalendarButton . getLocationOnScreen ( ) . x + toggleCalendarButton . getBounds ( ) . width - popup . getBounds ( ) . width - 2 ; int defaultY = toggleCalendarButton . getLocationOnScreen ( ) . y + toggleCalendarButton . getBounds ( ) . height + 2 ; zSetPopupLocation ( popup , defaultX , defaultY , this , dateTextField , 2 , 6 ) ; popup . show ( ) ; calendarPanel . requestFocus ( ) ; }
target:  openPopup, This opens the calendar popup. If the date picker contains a lastValidDate, the calendar will be opened to the month and year of the lastValidDate, with the lastValidDate marked as selected. If the lastValidDate is null, then the calendar will be opened with today's month and year displayed, and no date will be selected. This function creates a new calendar and a new custom popup instance each time that it is called. The associated object instances are automatically disposed and set to null when a popup is closed.