private Point fixToolTipLocation( Component owner, Component contents, int x, int y ) {
		if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() || hasTipLocation( owner ) )
			return null;

		PointerInfo pointerInfo = MouseInfo.getPointerInfo();
		if( pointerInfo == null )
			return null;

		Point mouseLocation = pointerInfo.getLocation();
		Dimension tipSize = contents.getPreferredSize();

		// check whether mouse location is within tooltip bounds
		Rectangle tipBounds = new Rectangle( x, y, tipSize.width, tipSize.height );
		if( !tipBounds.contains( mouseLocation ) )
			return null;

		// find GraphicsConfiguration at mouse location (similar to ToolTipManager.getDrawingGC())
		GraphicsConfiguration gc = null;
		for( GraphicsDevice device : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices() ) {
			GraphicsConfiguration dgc = device.getDefaultConfiguration();
			if( dgc.getBounds().contains( mouseLocation ) ) {
				gc = dgc;
				break;
			}
		}
		if( gc == null && owner != null )
			gc = owner.getGraphicsConfiguration();
		if( gc == null )
			return null;

		Rectangle screenBounds = gc.getBounds();
		Insets screenInsets = FlatUIUtils.getScreenInsets( gc );
		int screenTop = screenBounds.y + screenInsets.top;

		// place tooltip above mouse location if there is enough space
		int newY =  mouseLocation.y - tipSize.height - UIScale.scale( 20 );
		if( newY < screenTop )
			return null;

		return new Point( x, newY );
	}
Usually ToolTipManager places a tooltip at (mouseLocation.x, mouseLocation.y + 20).
In case that the tooltip would be partly outside of the screen,
the ToolTipManager changes the location so that the entire tooltip fits on screen.
But this can place the tooltip under the mouse location and hide the owner component.
<p>
This method checks whether the current mouse location is within tooltip bounds
and corrects the y-location so that the tooltip is placed above the mouse location.
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java