private void installMouseForwardingListenerWorkaround(final JTabbedPane tabbedPane) {

		forwardingListener = new TabContainerForwardingMouseListener(tabbedPane);

		addHierarchyListener(new HierarchyListener() {
			@Override
			public void hierarchyChanged(HierarchyEvent e) {
				long changeFlags = e.getChangeFlags();
				if (HierarchyEvent.DISPLAYABILITY_CHANGED == (changeFlags &
					HierarchyEvent.DISPLAYABILITY_CHANGED)) {

					Container myParent = getParent(); // should be a TabContainer

					// check for the first time we are put together
					boolean isDisplayable = isDisplayable();
					if (isDisplayable) {
						// remove and add in order to prevent duplicate adding
						myParent.removeMouseListener(forwardingListener);
						myParent.removeMouseMotionListener(forwardingListener);
						myParent.addMouseListener(forwardingListener);
						myParent.addMouseMotionListener(forwardingListener);

						hierarchyListener = this;
					}
					else if (hierarchyListener != null) {
						myParent.removeMouseListener(forwardingListener);
						myParent.removeMouseMotionListener(forwardingListener);

						removeHierarchyListener(hierarchyListener);
					}
				}
			}
		});
	}
A widget that can be used to render an icon, title and close button for JTabbedPane.  You would 
use this class with the tabbed pane by calling {@link JTabbedPane#setTabComponentAt(int, Component)}
Ghidra/Framework/Docking/src/main/java/docking/widgets/tabbedpane/DockingTabRenderer.java