void (RunnerContentUi ui, DockableContent dockable, RelativePoint dropTarget) { myBoundingBox = null; setNeedsRepaint(true); if (!(dockable instanceof DockableGrid)) return; JComponent component = ui.myComponent; Point point = dropTarget != null ? dropTarget.getPoint(component) : null; // do not paint anything if adding to the top if (ui.myTabs.shouldAddToGlobal(point)) return; // calc target place-in-grid PlaceInGrid targetPlaceInGrid = null; for (Content c : ((DockableGrid)dockable).getContents()) { View view = ui.getStateFor(c); if (view.isMinimizedInGrid()) continue; PlaceInGrid defaultGridPlace = ui.getLayoutSettings().getDefaultGridPlace(c); targetPlaceInGrid = point == null ? defaultGridPlace : calcPlaceInGrid(point, component.getSize()); break; } if (targetPlaceInGrid == null) return; // calc the default rectangle for the targetPlaceInGrid "area" Dimension size = component.getSize(); Rectangle r = new Rectangle(size); switch (targetPlaceInGrid) { case left -> r.width /= 3; case center -> { r.width /= 3; r.x += r.width; } case right -> { r.width /= 3; r.x += 2 * r.width; } case bottom -> { r.height /= 4; r.y += 3 * r.height; } } // adjust the rectangle if the target grid cell is already present and showing for (Content c : ui.getContentManager().getContents()) { GridCell cellFor = ui.findCellFor(c); PlaceInGrid placeInGrid = cellFor == null ? null : ((GridCellImpl)cellFor).getPlaceInGrid(); if (placeInGrid != targetPlaceInGrid) continue; Wrapper wrapper = ComponentUtil.getParentOfType((Class<? extends Wrapper>)Wrapper.class, (Component)c.getComponent()); JComponent cellWrapper = wrapper == null ? null : (JComponent)wrapper.getParent(); if (cellWrapper == null || !cellWrapper.isShowing()) continue; r = new RelativeRectangle(cellWrapper).getRectangleOn(component); break; } myBoundingBox = new Rectangle2D.Double(r.x, r.y, r.width, r.height); }