Skip to content

Kotling + Swing -> Kotling. A DSL to build Swing User Interfaces - Inspired from TornadoFX

Notifications You must be signed in to change notification settings

deggers/Kotling

Repository files navigation

Kotling (Just-Another-Sideproject)

Just an idea about possible implementation to have a nicer developer expierience while doing UI.

🎯 Features

  • JavaFX like DSL abstraction for Swing
  • I18n Support (to be implemented)
  • Model-View-Intend (to be implemented)

💡 Philosophy

When developer have to switch form JavaFX to Swing for various reason, they are dealing with a learning curve before they can start building their front-end applications. Kotling, as a UI framework, was created with the idea of minimalism and follows the UNIX way, so that developer can quickly enter the world of Swing with a warm and trusted welcome.

Kotling is inspired by TornadoFX, the most popular JavaFX DSL on the Internet. If you have ever implemented a front-end application using JavaFX or similar, then many methods and principles will seem very common to you.

👀 Examples

BorderPane

The concept of a BorderPane is taken from JavaFX. It gives the possbility to set into the borders, top, left, bottom, right or the center any Component.

colorfulborderpane.jpg

This is possible via the DSL using plain JPanels: The actual code for this using plain JPanels is the following:

class BorderPaneDemoView : KotlingView("Demo") {
    override val root = borderPane {
        top = JPanel().also {
            it.background = Color.ORANGE
            it.preferredSize = Dimension(200, 200)
        }
        left = JPanel().also {
            it.background = Color.RED
            it.preferredSize = Dimension(200, 200)
        }
        bottom = JPanel().also {
            it.background = Color.GREEN
            it.preferredSize = Dimension(200, 200)
        }
        right = JPanel().also {
            it.background = Color.BLUE
            it.preferredSize = Dimension(200, 200)
        }
        center = JPanel().also {
            it.background = Color.LIGHT_GRAY
        }
    }
}

Or by constructing a KBorderPane via its named arguments:

class ConstructorBorderPaneDemoView : KotlingView("Demo") {
    override val root = KBorderPane(
        top = JPanel().also {
            it.background = Color.ORANGE
            it.preferredSize = Dimension(200, 200)
        },
        left = JPanel().also {
            it.background = Color.RED
            it.preferredSize = Dimension(200, 200)
        },
        bottom = JPanel().also {
            it.background = Color.GREEN
            it.preferredSize = Dimension(200, 200)
        },
        right = JPanel().also {
            it.background = Color.BLUE
            it.preferredSize = Dimension(200, 200)
        },
        center = JPanel().also {
            it.background = Color.LIGHT_GRAY
        }
    )
}

About

Kotling + Swing -> Kotling. A DSL to build Swing User Interfaces - Inspired from TornadoFX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages