diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7d3d9b4..208bbfa 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,12 +1,12 @@ plugins { id("org.jetbrains.kotlin.jvm") version "1.8.10" - id("org.openjfx.javafxplugin") version "0.0.8" + id("org.openjfx.javafxplugin") version "0.0.12" application } javafx { - version = "11.0.2" - modules("javafx.controls") + version = "17" + modules ( "javafx.controls", "javafx.fxml" ) } repositories { diff --git a/app/src/main/kotlin/app/App.kt b/app/src/main/kotlin/app/App.kt index 75ce792..2af3768 100644 --- a/app/src/main/kotlin/app/App.kt +++ b/app/src/main/kotlin/app/App.kt @@ -1,9 +1,18 @@ package app import app.view.MainView +import javafx.stage.Stage import tornadofx.* -class MainApp: App(MainView::class) +class MainApp: App(MainView::class){ + override fun start(stage: Stage) { + with(stage){ + width = 600.0 + height = 400.0 + } + super.start(stage) + } +} fun main() { launch() diff --git a/app/src/main/kotlin/app/view/MainView.kt b/app/src/main/kotlin/app/view/MainView.kt index 5255fa2..751c32a 100644 --- a/app/src/main/kotlin/app/view/MainView.kt +++ b/app/src/main/kotlin/app/view/MainView.kt @@ -1,10 +1,15 @@ package app.view - +import app.view.treeView.BinarySearchTreeView import tornadofx.* -class MainView: View("Trees") { - override val root = vbox { - button("Hello, World!") - label("Waiting") +class MainView: View(){ + private val tree = BinarySearchTreeView() + override val root = borderpane { + center{ + add(tree) + } + left{ + button("reset") + } } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/view/treeView/AVLTreeView.kt b/app/src/main/kotlin/app/view/treeView/AVLTreeView.kt new file mode 100644 index 0000000..c2a8bf9 --- /dev/null +++ b/app/src/main/kotlin/app/view/treeView/AVLTreeView.kt @@ -0,0 +1,16 @@ +package app.view.treeView +import tornadofx.* +class AVLTreeView: View() { + override val root = vbox { + button("Binary Search Tree") { + action { + replaceWith() + } + } + button("Red Black Tree") { + action { + replaceWith() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/kotlin/app/view/treeView/BinarySearchTreeView.kt b/app/src/main/kotlin/app/view/treeView/BinarySearchTreeView.kt new file mode 100644 index 0000000..2224fc7 --- /dev/null +++ b/app/src/main/kotlin/app/view/treeView/BinarySearchTreeView.kt @@ -0,0 +1,17 @@ +package app.view.treeView +import tornadofx.* + +class BinarySearchTreeView: View() { + override val root = vbox { + button("AVL Tree") { + action { + replaceWith() + } + } + button("Red Black Tree") { + action { + replaceWith() + } + } + } +} diff --git a/app/src/main/kotlin/app/view/treeView/RedBlackTreeView.kt b/app/src/main/kotlin/app/view/treeView/RedBlackTreeView.kt new file mode 100644 index 0000000..787f2e6 --- /dev/null +++ b/app/src/main/kotlin/app/view/treeView/RedBlackTreeView.kt @@ -0,0 +1,23 @@ +package app.view.treeView +import app.view.treeView.AVLTreeView +import app.view.treeView.BinarySearchTreeView +import tornadofx.View +import tornadofx.action +import tornadofx.button +import tornadofx.vbox + +class RedBlackTreeView: View() { + override val root = vbox { + button("AVL Tree") { + action { + replaceWith() + } + } + + button("Binary Search Tree") { + action { + replaceWith() + } + } + } +} \ No newline at end of file