Skip to content

mslxl/KtSwing

Repository files navigation

KtSwing

A simple DSL library for Swing.

JitPack Travis-CI

How it looks like

fun searchBar() = swing<JPanel> {
    panel {
        attr {
            border = TitledBorder("Search")
        }
        borderLayout {
            center {
                textField()
            }
            right {
                button("Search")
            }
        }
    }
}

fun main() =
    frame {
        attr {
            title = "Sample"
            bounds = bounds.withH(400).withW(500)
        }
        borderLayout {
            top {
                add(searchBar())
            }
            center {
                textArea()
            }
        }
    }.exitOnClose

Sample

How to use it

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

    dependencies {
    implementation 'com.github.mslxl:KtSwing:2.1.2'
}

Enjoy it!

About

A Kotlin DSL wrapper library for Swing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages