public static @Nullable Component getComponentFromRecentMouseEvent() {
    AWTEvent event = IdeEventQueue.getInstance().getTrueCurrentEvent();
    if (event instanceof MouseEvent mouseEvent) {
      Component component = mouseEvent.getComponent();
      if (component != null) {
        component = SwingUtilities.getDeepestComponentAt(component, mouseEvent.getX(), mouseEvent.getY());
        if (component != null) {
          if (component instanceof JTabbedPane tabbedPane) {
            mouseEvent = SwingUtilities.convertMouseEvent(mouseEvent.getComponent(), mouseEvent, component);
            int index = tabbedPane.getUI().tabForCoordinate(tabbedPane, mouseEvent.getX(), mouseEvent.getY());
            if (index != -1) return tabbedPane.getComponentAt(index);
          }
          return component;
        }
      }
    }
    return null;
  }
public static @Nullable Component getComponentFromRecentMouseEvent()