Rectangle (@NotNull MouseEvent event) { Rectangle buttonBounds = getCloseButtonScreenBounds(); if (buttonBounds == null) { return null; } if (myCloseButton != null && !myCloseButton.isVisible()) { myCloseButton.setVisible(true); return buttonBounds; } boolean mouseOverButton = buttonBounds.contains(event.getLocationOnScreen()); return (mouseOverButton ^ myCloseButtonHovered) ? buttonBounds : null; }