KSwing is a Kotlin library for the Java Swing toolkit, inspired by Kotlin Compose and SwiftUI.
val pizzasOrdered = KNonnullState(1)
KGroupPanel {
KFlowPanel(addConstraints = BorderLayout.CENTER) {
KHGlue()
KLabel {
pizzasOrdered.use {
text = "$it pizzas will be ordered"
}
}
}
KFlowPanel(addConstraints = BorderLayout.PAGE_END) {
KButton("Add another").kActionListener { pizzasOrdered.value++ }
}
}See the GitHub wiki for a tutorial.
There are currently three examples:
A simple recreation of a JDialog using either GridBagLayout or GroupLayout,

A simple reminders app that lets you add/remove, check off and set the time of your reminders,

These are located in the example directory and use FlatLaf as their look and feel. They're also available as a runnable jar on GitHub releases!
The library and the examples are under a very liberal BSD-2 clause license. See the LICENSE file for more.
Add the maven repo:
Gradle (Kotlin)
maven {
name = "teamcelestial"
url = "https://maven.teamcelestial.org/public"
}Gradle (Groovy)
maven {
name "teamcelestial"
url "https://maven.teamcelestial.org/public"
}Maven
<repository>
<id>teamcelestial</id>
<url>https://maven.teamcelestial.org/public</url>
</repository>Then add the dependency:
Gradle (Kotlin)
implementation("me.thosea:libkswing:<version>")Gradle (Groovy)
implementation "me.thosea:libkswing:<version>"Maven
<dependency>
<groupId>me.thosea</groupId>
<artifactId>libkswing</artifactId>
<version>version</version>
</dependency>Find the latest version here: https://maven.teamcelestial.org/#/public/me/thosea/libkswing/
