Jewel Swing Interop
Embed Compose/Jewel into Swing with bridge primitives from ide-laf-bridge and foundation.
Quick Snippets
Tool window tab:
toolWindow.addComposeTab(tabDisplayName = "My Tab") {
SwingBridgeTheme {
MyToolWindowContent()
}
}
Generic Swing host:
val panel = JewelComposePanel {
MyPluginComposable()
}
Manual compositing enablement (non-toolwindow entrypoint):
enableNewSwingCompositing()
val panel = JewelComposePanel { MyPluginComposable() }
Use The Highest-Level API First
Pick the simplest valid entrypoint:
- •Tool window tab:
ToolWindow.addComposeTab(...). - •Generic Swing host:
compose(...)/JewelComposePanel(...). - •Custom theming flow:
composeWithoutTheme(...)/JewelComposeNoThemePanel(...).
Default to themed entrypoints; use no-theme variants only when theme wrapping is intentionally external.
Enable New Swing Compositing Early
Call enableNewSwingCompositing() before attaching Compose content when needed.
Notes:
- •
ToolWindow.addComposeTab(...)already does this internally. - •Function is idempotent and safe at multiple entry points.
- •This improves z-order/resizing behavior but can affect performance with infinitely repeating animations.
- •Treat
enableNewSwingCompositing()and no-theme entrypoints as advanced/experimental paths.
Apply Bridge Theme In Plugin Context
Use SwingBridgeTheme for IntelliJ plugin UI:
- •Pulls Swing LaF colors/metrics/typography into Compose.
- •Provides bridge locals (icon/new-ui behavior, clipboard, density scaling, shortcuts, URI handling).
Do not use standalone IntUiTheme for plugin-hosted Swing integration.
Bridge Compose To Swing/AWT Safely
For bidirectional operations:
- •Use
LocalComponentto obtain host Swing component when APIs requireComponent. - •Use bridge utilities for color conversion and LaF key lookup when styling custom interop elements.
- •Keep file chooser and dialog operations delegated to Swing (
JFileChooser, etc.) from Compose callbacks.
Version Discipline
Treat this skill as Jewel-version scoped.
- •Ask for target IntelliJ Platform baseline and Jewel API version.
- •Validate behavior against Jewel release notes when APIs differ by platform generation.
- •Prefer high-level bridge entrypoints that are stable in target versions.
- •For shipped skill updates, refresh reference links to the corresponding release tag.
Interop Checklist
Before finishing:
- •Confirm compositing flag is set at proper entrypoints.
- •Confirm theme wrapper is
SwingBridgeTheme(unless deliberately no-theme). - •Confirm host component access uses
LocalComponent. - •Confirm toolwindow integrations use
addComposeTabwhen applicable. - •Confirm interop code avoids creating extra unmanaged
ComposePanelwrappers.
References
Read these source files when implementing: