A simple DSL library for Swing.
JitPack | Travis-CI |
---|---|
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
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!