Skip to content
Snippets Groups Projects
Commit e4d4db9f authored by Abhay Menon's avatar Abhay Menon
Browse files

Updated branch to display basic GUI

parent fc58fdce
No related branches found
No related tags found
1 merge request!10Added basic GUI to console application
Pipeline #84289 passed
......@@ -4,6 +4,14 @@
plugins {
id 'notes.multi.kotlin-application-conventions'
id 'application'
id 'org.jetbrains.kotlin.jvm'
id 'org.openjfx.javafxplugin' version '0.0.13'
}
javafx {
version = '18.0.2'
modules = ['javafx.controls', 'javafx.graphics']
}
dependencies {
......
......@@ -5,10 +5,20 @@ package notes.multi.console
import notes.multi.utilities.Filemanager
import notes.multi.utilities.Note
import notes.multi.utilities.TextWindow
import javafx.application.Application
fun main() {
// thesea re test functions feel free to use
val f = Filemanager("${System.getProperty("user.dir")}/test/", "hello.txt")
f.writefile("hello world")
f.deletefile()
println(f.openfile())
val n = Note()
val noteTitle = n.title
val noteContent = n.text.toString()
println(noteContent)
Application.launch(TextWindow()::class.java, "--title=${noteTitle}", "--text=${noteContent}")
// val f = Filemanager("${System.getProperty("user.dir")}/test/", "hello.txt")
// f.writefile("hello world")
// f.deletefile()
// println(f.openfile())
}
......@@ -6,20 +6,35 @@ import javafx.scene.Scene
import javafx.scene.control.ScrollPane
import javafx.scene.control.TextArea
import javafx.scene.layout.VBox
import javafx.application.Application.Parameters
class TextWindow(val note: Note): Application() {
class TextWindow(): Application() {
var paramsMap = mutableMapOf<String, String>()
override fun init() {
super.init()
val params = getParameters()
paramsMap = params.getNamed()
}
override fun start(stage: Stage?) {
stage?.setTitle(note.title)
override fun start(stage: Stage) {
stage.setTitle(paramsMap["title"])
val textarea = TextArea()
textarea.setText(note.text.toString())
textarea.setText(paramsMap["text"])
textarea.setWrapText(true)
val scroll = ScrollPane()
scroll.setFitToHeight(true)
scroll.setHmin(300.0)
scroll.setFitToWidth(true)
// REMOVE THESE COMMENTS
// println("===========")
// println(scroll.isFitToHeight)
// println(scroll.isFitToWidth)
scroll.content = textarea
stage?.scene = Scene(VBox(scroll), 300.0, 300.0)
stage?.show()
stage.scene = Scene(VBox(scroll), 300.0, 300.0)
stage.show()
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment