Presentation for first ever Kotlin Bosnia meetup held in Banja Luka.
This talk is live coding session aimed to present how Kotlin can help as in working with old Java toolkits such as Swing. The end result of talk is a small DSL for Swing that transforms Swing GUI components into more readable and concise code structures.
Code sample:
https://github.com/Vuksa/SwingDSL/tree/dsl_complete
5. What is Kotlin?
statically-typed object oriented programming language
targeting JVM, Android and JavaScript
fully interoperable with Java
third party library
has excellent IDE support
Google acknowledged
8. What is Kotlin?
statically-typed object oriented programming language
targeting JVM, Android and JavaScript
fully interoperable with Java
9. What is Kotlin?
statically-typed object oriented programming language
targeting JVM, Android and JavaScript
fully interoperable with Java
third party library
10. What is Kotlin?
statically-typed object oriented programming language
targeting JVM, Android and JavaScript
fully interoperable with Java
third party library
has excellent IDE support
11. What is Kotlin?
statically-typed object oriented programming language
targeting JVM, Android and JavaScript
fully interoperable with Java
third party library
has excellent IDE support
Google acknowledged
12. Kotlin history
developed by JetBrains
unveiled to public in 2011.(development started in 2012.)
1.0 first stable version (February 2016.)
current version 1.2 Beta
18. What is Swing?
GUI widget toolkit in Java
introduced in 1997
A Swing GUI consists of components and containers
19. What is Swing?
GUI widget toolkit in Java
introduced in 1997
A Swing GUI consists of components and containers
Swing components are lightweight and don’t rely on peers
20. What is Swing?
GUI widget toolkit in Java
introduced in 1997
A Swing GUI consists of components and containers
Swing components are lightweight and don’t rely on peers
supports pluggable look and feel
21. Swing GUI code
JFrame jfrm = new JFrame("A Simple Swing Program");
// Give the frame an initial size.
jfrm.setSize(275, 100);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create a text-based label.
JLabel jlab = new JLabel(" Swing powers the modern Java GUI.");
// Add the label to the content pane.
jfrm.getContentPane().add(jlab);
// Display the frame.
jfrm.setVisible(true);
22. How we would like it to look like?
frame(title = "A Simple Swing Program") {
size = 275 x 100
defaultCloseOperation = EXIT_ON_CLOSE
isVisible = true
label(label = "Swing powers the modern Java GUI.") {
}
}
24. Other Kotlin DSLs
● Anko - dsl for Android
● Kobalt - dsl like build system
● Kaadin - dsl for Vaadin
● TornadoFX - JavaFx dsl framework
25. Resources to learn more
● Official Kotlin documentation
● Official Kotlin Github
● Kotlin koans
● Anko
● TornadoFX
● Kaadin
● Kobolt
● Awesome Kotlin – collection of materials
● Slack kanal
28. Nebojša Vukšić
Android developer @ codecentric
Founder of Kotlin User Group Serbia
nebojsa92vuksic@gmail.com
Kotlin User Group Serbia
https://www.meetup.com/Serbia-Kotlin-User-Group
https://www.facebook.com/kotlinserbia/
https://twitter.com/kotlin_serbia
TheTechW0lf