diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index ff3ca2e..76dcf82 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -10,6 +10,7 @@
+
diff --git a/lesson2/build.gradle.kts b/lesson2/build.gradle.kts
new file mode 100644
index 0000000..bc934ac
--- /dev/null
+++ b/lesson2/build.gradle.kts
@@ -0,0 +1,23 @@
+plugins {
+ kotlin("jvm")
+}
+
+group = "com.msksbr.jfxLearn"
+version = "unspecified"
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation(kotlin("test"))
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
+kotlin {
+ jvmToolchain(17)
+}
+
+application.mainClass.set("com.msksbr.jfxLearn.lesson2.MainKt")
\ No newline at end of file
diff --git a/lesson2/src/main/kotlin/Main.kt b/lesson2/src/main/kotlin/Main.kt
new file mode 100644
index 0000000..8c2bc5a
--- /dev/null
+++ b/lesson2/src/main/kotlin/Main.kt
@@ -0,0 +1,56 @@
+/**
+ * Lesson: JavaFX Application Structure
+ *
+ * 1. The Application class serves as the entry point for JavaFX applications.
+ * 2. The main method initiates the JavaFX runtime via Application.launch(String... args).
+ * 3. When launch() is called without arguments, the application lifecycle follows:
+ * - init(): Initialization phase
+ * - start(): Primary stage setup
+ * - stop(): Cleanup upon application exit
+ */
+
+package com.msksbr.jfxLearn.lesson2
+
+import javafx.application.Application
+import javafx.scene.Scene
+import javafx.stage.Stage
+import javafx.scene.control.Button
+import javafx.scene.layout.BorderPane
+
+class MainApplication : Application() {
+ override fun start(stage: Stage) {
+ println("we are in start method")
+ // Extension Exercises: create a button, when it clicked, open a website via browser
+ val button = Button("open website")
+ button.setOnAction {
+ hostServices.showDocument("https://msksbr.com")
+ }
+ val borderPane = BorderPane(button)
+ val scene = Scene(borderPane, 300.0, 300.0)
+
+ stage.scene = scene
+ stage.title = "JavaFX Application"
+ stage.show()
+ }
+
+ override fun init() {
+ // what can we do in init method?
+ // 1. connect database
+ // 2, create a new thread
+ // ...
+ println("we are in init method")
+ }
+
+ override fun stop() {
+ // what can we do in stop method?
+ // 1. close database connection
+ // 2. close a thread
+ // 3. clean resources
+ // ...
+ println("we are in stop method")
+ }
+}
+
+fun main(args: Array) {
+ Application.launch(MainApplication::class.java, *args)
+}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 634362a..763f9ac 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,2 +1,3 @@
rootProject.name = "jfx-learn"
-include("lesson1")
\ No newline at end of file
+include("lesson1")
+include("lesson2")
\ No newline at end of file