code: private void dateLabelMousePressed(MouseEvent e) {
          // Get the label that was clicked.
          JLabel label = (JLabel) e.getSource();
          // If the label is empty, do nothing and return.
          String labelText = label.getText();
          if ("".equals(labelText)) {
              return;
          }
          // We have a label with a specific date, so set the date and close the calendar.
          int dayOfMonth = Integer.parseInt(labelText);
          LocalDate clickedDate = LocalDate.of(
              displayedYearMonth.getYear(), displayedYearMonth.getMonth(), dayOfMonth);
          userSelectedADate(clickedDate);
      }
docs: dateLabelMousePressed, This event is called any time that the user clicks on a date label in
  the calendar. This sets the date picker to the selected date, and closes the calendar panel.