Rectangle () { JFrame frame = (JFrame)ComponentUtil.findUltimateParent(myProgressPanel.getComponent$intellij_platform_ide_impl()); Dimension contentSize = myContentPanel.getPreferredSize(); int contentWidth = Math.max(contentSize.width, JBUI.scale(300)); int contentHeight = Math.max(contentSize.height, JBUI.scale(100)); int titleHeight = 0; if (myPopup instanceof AbstractPopup) { titleHeight = ((AbstractPopup)myPopup).getHeaderPreferredSize().height; } Rectangle frameBounds = frame.getBounds(); int fullHeight = frameBounds.height - titleHeight; boolean isEmpty = myIndicatorPanel.getComponentCount() == 0; int width = Math.max(frameBounds.width / 4, contentWidth); int height = Math.min(isEmpty ? frameBounds.height / 4 : fullHeight, contentHeight); int x = frameBounds.x + frameBounds.width - width - JBUI.scale(20); int y = frameBounds.y + frameBounds.height - height; if (height != fullHeight) { y -= JBUI.scale(10); } StatusBarEx sb = (StatusBarEx)((IdeFrame)frame).getStatusBar(); if (sb != null && sb.isVisible()) { int statusBarHeight = sb.getSize().height; if (height == fullHeight) { height -= statusBarHeight + JBUI.scale(10); } else { y -= statusBarHeight; } } y -= titleHeight; return new Rectangle(x, y, width, height); }