protected void updatePopupLocation() {
		final Point los = DatePickerButton.this.getLocationOnScreen();
		final Rectangle gb = popup.getGraphicsConfiguration().getBounds();
		final boolean ltr = DatePickerButton.this.getComponentOrientation().isLeftToRight();
		final int w = DatePickerButton.this.getWidth();
		final int h = DatePickerButton.this.getHeight();

		final int x;
		if (ltr) {
			if (los.x + popup.getWidth() <= gb.x + gb.width) {
				x = los.x;
			} else {
				x = los.x + w - popup.getWidth();
			}
		} else {
			if (los.x + w - popup.getWidth() >= gb.x) {
				x = los.x + w - popup.getWidth();
			} else {
				x = los.x;
			}
		}

		final int y;
		if (los.y + h + popup.getHeight() <= gb.y + gb.height) {
			y = los.y + h;
		} else {
			y = los.y - popup.getHeight();
		}

		popup.setLocation(x, y);
	}