Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.84 KB

theming-ktx.md

File metadata and controls

30 lines (21 loc) · 1.84 KB

Kotlin extensions for Radiance look-and-feel APIs

Maven Central radiance-theming-ktx for build instructions of the latest stable release.

In your Java app, this is how you would mark a BreadcrumbBarSelector to use the HEADER decoration area type:

BreadcrumbFileSelector bar = new BreadcrumbFileSelector();
RadianceThemingCortex.ComponentOrParentChainScope.setDecorationType(bar,
        RadianceThemingSlices.DecorationAreaType.HEADER);

And here is how the same code would look like in Kotlin using a Radiance-provided extension on the JComponent class:

val bar = BreadcrumbFileSelector()
bar.setDecorationType(RadianceThemingSlices.DecorationAreaType.HEADER)

Scopes

Kotlin scopes mirror scopes defined in RadianceThemingCortex:

  • RadianceWindowScope - configuring and querying state at the level of the application Windows.
  • RadianceRootPaneScope - configuring and querying state at the level of the application JRootPanes.
  • RadianceComponentScope - configuring and querying state at the level of the application Components.
  • RadianceComponentOrParentScope - configuring and querying state at the level of individual application Components or all immediate child components of a container.
  • RadianceComponentOrParentChainScope - configuring and querying state at the level of individual application Components or all nested child components of a container.

Note that these are Kotlin annotations marking the extension functions on the relevant Swing classes. There is no global scope annotation as none of the RadianceThemingCortex.GlobalScope APIs are exposed via Radiance (yet).