findCompositionData

fun Component.findCompositionData(): CompositionData?

The data of the nearest composition this component hosts or stands in, or null where there is none. It answers whether or not that composition declared the component, so a component built by hand and added to composed content is answered with the composition it stands in.

The walk starts at this component, so one that hosts a content composition of its own is answered with that composition - the one it carries is nearer than the one that declared it. Use findDeclaringGroup for the other question: which group declared a component.

A composition rooted at a java.awt.Container that is no JComponent is never found, neither for the components it declared nor for the ones standing in it.

The same freshness rule as findDeclaringGroup applies: the next recomposition of that composition retires the answer.

Must be called on the Event Dispatch Thread.