Skip to content
Snippets Groups Projects
Commit e423c73b authored by Guransh Khurana's avatar Guransh Khurana
Browse files

fixes the textarea so it sizes with the window while resizing

parent e4d4db9f
No related branches found
No related tags found
1 merge request!10Added basic GUI to console application
Pipeline #84346 passed
...@@ -6,7 +6,9 @@ import javafx.scene.Scene ...@@ -6,7 +6,9 @@ import javafx.scene.Scene
import javafx.scene.control.ScrollPane import javafx.scene.control.ScrollPane
import javafx.scene.control.TextArea import javafx.scene.control.TextArea
import javafx.scene.layout.VBox import javafx.scene.layout.VBox
import javafx.scene.layout.AnchorPane
import javafx.application.Application.Parameters import javafx.application.Application.Parameters
import javafx.scene.layout.Priority
class TextWindow(): Application() { class TextWindow(): Application() {
var paramsMap = mutableMapOf<String, String>() var paramsMap = mutableMapOf<String, String>()
...@@ -22,6 +24,12 @@ class TextWindow(): Application() { ...@@ -22,6 +24,12 @@ class TextWindow(): Application() {
textarea.setText(paramsMap["text"]) textarea.setText(paramsMap["text"])
textarea.setWrapText(true) textarea.setWrapText(true)
val scroll = ScrollPane() val scroll = ScrollPane()
val anchor = AnchorPane(textarea)
AnchorPane.setTopAnchor(textarea, 0.0)
AnchorPane.setBottomAnchor(textarea, 0.0)
AnchorPane.setLeftAnchor(textarea, 0.0)
AnchorPane.setRightAnchor(textarea, 0.0)
scroll.setFitToHeight(true) scroll.setFitToHeight(true)
scroll.setHmin(300.0) scroll.setHmin(300.0)
...@@ -33,8 +41,10 @@ class TextWindow(): Application() { ...@@ -33,8 +41,10 @@ class TextWindow(): Application() {
// println(scroll.isFitToWidth) // println(scroll.isFitToWidth)
scroll.content = textarea scroll.content = textarea
val box = VBox(anchor)
VBox.setVgrow(anchor, Priority.ALWAYS)
stage.scene = Scene(VBox(scroll), 300.0, 300.0) stage.scene = Scene(box, 300.0, 300.0)
stage.show() 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