void (boolean fullReset, @NotNull Dimension availSize, @NotNull Dimension oldSize, @NotNull Dimension newSize) { Dimension delta = new Dimension(newSize.width - oldSize.width, newSize.height - oldSize.height); if (!fullReset) { if (myOrientation == SwingConstants.HORIZONTAL) delta.width = 0; if (myOrientation == SwingConstants.VERTICAL) delta.height = 0; } delta.width = Math.max(0, delta.width - Math.max(0, availSize.width - oldSize.width)); delta.height = Math.max(0, delta.height - Math.max(0, availSize.height - oldSize.height)); if (delta.width == 0 && delta.height == 0) { return; } JBPopup popup = PopupUtil.getPopupContainerFor(this); if (popup != null) { Dimension size = popup.getSize(); size.width += delta.width; size.height += delta.height; popup.setSize(size); popup.moveToFitScreen(); } else { JComponent parent = getParentLightweightHintComponent(this); if (parent != null) { // a LightweightHint that fits in Dimension size = parent.getSize(); size.width += delta.width; size.height += delta.height; parent.setSize(size); } } }