diff --git a/console/build.gradle b/console/build.gradle index 127f593824197af01f3a9e31f4d01936d3ab1075..c32e5dfcae2acbfa480e1943db2dbe92317bc277 100644 --- a/console/build.gradle +++ b/console/build.gradle @@ -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 { diff --git a/console/src/main/kotlin/notes/multi/console/Console.kt b/console/src/main/kotlin/notes/multi/console/Console.kt index 7db3c2789822e1b85a45bc11572aec029ae85610..9ae4ea55dd68c40ca4aadf2650c698d2a7b1ee5d 100644 --- a/console/src/main/kotlin/notes/multi/console/Console.kt +++ b/console/src/main/kotlin/notes/multi/console/Console.kt @@ -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()) } diff --git a/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt b/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt index be95fc6fd6cfa78dfbc76bb22743d3d57c33e676..d84e2b0f9d7d3070ac80eaac470ab0709b8207cc 100644 --- a/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt +++ b/utilities/src/main/kotlin/notes/multi/utilities/NoteTextWindow.kt @@ -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