Dimension (Container parent) { int w1 = WidthBasedLayout.getPreferredWidth(highlightInfoComponent); int w2 = WidthBasedLayout.getPreferredWidth(quickDocComponent); int preferredWidth = Math.min(JBUI.scale(MAX_POPUP_WIDTH), Math.max(w1, w2)); int h1 = WidthBasedLayout.getPreferredHeight(highlightInfoComponent, preferredWidth); int h2 = WidthBasedLayout.getPreferredHeight(quickDocComponent, preferredWidth); return new Dimension(preferredWidth, h1 + h2); }