private void positionRelativeTo(JComponent component) {

		Rectangle bounds = getBounds();

		// no label implies we are launched from a keyboard event
		if (component == null) {

			Point centerPoint = WindowUtilities.centerOnComponent(getParent(), this);
			bounds.setLocation(centerPoint);
			WindowUtilities.ensureEntirelyOnScreen(getParent(), bounds);
			setBounds(bounds);
			return;
		}

		// show the window just below the label that launched it
		Point p = component.getLocationOnScreen();
		int x = p.x;
		int y = p.y + component.getHeight() + 3;
		bounds.setLocation(x, y);

		// fixes problem where popup gets clipped when going across screens
		WindowUtilities.ensureOnScreen(component, bounds);
		setBounds(bounds);
	}
Undecorated dialog for showing a popup window displaying a filterable, scrollable list of tabs
in a {@link GTabPanel}.

@param <T> the value types
Ghidra/Framework/Docking/src/main/java/docking/widgets/tab/TabListPopup.java