code: static void zSetPopupLocation(CustomPopup popup, int defaultX, int defaultY, JComponent picker,
              JComponent verticalFlipReference, int verticalFlipDistance, int bottomOverlapAllowed) {
          // Gather some variables that we will need.
          Window topWindowOrNull = SwingUtilities.getWindowAncestor(picker);
          Rectangle workingArea = InternalUtilities.getScreenWorkingArea(topWindowOrNull);
          int popupWidth = popup.getBounds().width;
          int popupHeight = popup.getBounds().height;
          // Calculate the default rectangle for the popup.
          Rectangle popupRectangle = new Rectangle(defaultX, defaultY, popupWidth, popupHeight);
          // If the popup rectangle is below the bottom of the working area, then move it upwards by 
          // the minimum amount which will ensure that it will never cover the picker component.
          if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
              popupRectangle.y = verticalFlipReference.getLocationOnScreen().y - popupHeight
                      - verticalFlipDistance;
          }
          // Confine the popup to be within the working area.
          if (popupRectangle.getMaxX() > (workingArea.getMaxX())) {
              popupRectangle.x -= (popupRectangle.getMaxX() - workingArea.getMaxX());
          }
          if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
              popupRectangle.y -= (popupRectangle.getMaxY() - workingArea.getMaxY());
          }
          if (popupRectangle.x < workingArea.x) {
              popupRectangle.x += (workingArea.x - popupRectangle.x);
          }
          if (popupRectangle.y < workingArea.y) {
              popupRectangle.y += (workingArea.y - popupRectangle.y);
          }
          // Set the location of the popup.
          popup.setLocation(popupRectangle.x, popupRectangle.y);
      }
docs: zSetPopupLocation, This calculates and sets the appropriate location for the popup windows,
  for both the DatePicker and the TimePicker.