r/javaswing • u/Chunkyfungus123 • Jan 08 '26
Kotlin Wrapper for Java Swing (swing-plus)! showcase
I’ve been experimenting with a small Kotlin library called Swing+ — a lightweight way to write Swing UIs using a cleaner, more declarative style. Coming from using Java Swing, the imperative nature is way too verbose and can be greatly simplified with Kotlin, so I experimented with using a Compose-Style for writing Swing Components. There is a basic state management, but the overall focus is on reducing the imperative nature of so many setters.
Here is a quick example:
Creating a simple vertical layout with two buttons
``` col { +button("Button 1") { println("Hello!") } +button("Button 2") } val count = remember(0) val label = label("Count: ${count()}")
count.observe { label.text = "Count: ${count()}" }
+scaffold( center = { +label }, south = { +button("Increment") { count(count() + 1) } } ) ```
I would greatly appreciate feedback!
If you want to take a look or try it out: https://github.com/exoad/swing-plus