Rectangle (@NotNull MouseEvent event) { Point location = event.getLocationOnScreen(); for (ArrangementUiComponent component : myComponents) { Rectangle bounds = component.getScreenBounds(); if (bounds == null || !bounds.contains(location)) { continue; } if (myComponentUnderMouse == null) { myComponentUnderMouse = component; Rectangle rectangleOnEnter = myComponentUnderMouse.onMouseEntered(event); Rectangle rectangleOnMove = myComponentUnderMouse.onMouseMove(event); if (rectangleOnEnter != null && rectangleOnMove != null) { return myScreenBounds; // Repaint row } else if (rectangleOnEnter != null) { return rectangleOnEnter; } else { return rectangleOnMove; } } else { if (myComponentUnderMouse != component) { myComponentUnderMouse.onMouseExited(); myComponentUnderMouse = component; component.onMouseEntered(event); return myScreenBounds; // Repaint row. } else { return component.onMouseMove(event); } } } if (myComponentUnderMouse == null) { return null; } else { Rectangle result = myComponentUnderMouse.onMouseExited(); myComponentUnderMouse = null; return result; } }