I have been trying to convert a school project I originally written in Java with Swing to Scala with ScalaFX. The GUI is basically a top bar with Buttons and a search input, while the bottom part of the bar is a TextArea that will display the output from the buttons. This is what the app looks like at startup. The problem is that when I expand the stage with my mouse, the size of the TextArea remains static. Here is an example of that. I tried looking up specific help for ScalaFX but it feels like the documentation out there is rather thin, so I have had to focus my research for JavaFX. I found a post on here about using HBox to have my textbox expand as I stretch the stage with my mouse, but it doesn't appear to be working. Is there a way to have the TextArea scale in size when the stage is stretched out with the mouse? I have included the code below of the GUI with the added HBox below.
object SorcerersCave extends JFXApp{
val informationText: TextArea = new TextArea()
stage = new PrimaryStage {
title = "Sorcerers Cave"
val searchBy = new ComboBox[String](List("Index", "Name", "Type")){
value = "Index"
}
val resizeableBox = new HBox(informationText){
hgrow = Priority.Always
}
val searchInput = new TextField() {prefWidth = 100}
val buttonPane = new FlowPane {
hgap = 5
children = Seq(new Button("Read") { onAction = handle { readFile }} ,
new Button("Display"){ onAction = handle { displayCave() }},
searchBy,
new Label("Search target:"),
searchInput,
new Button("Search"){ onAction = handle { search(searchInput.getText.toLowerCase.trim, searchBy.toString()) }}
)
}
scene = new Scene {
content = new BorderPane {
top = buttonPane
center = resizeableBox
}
}
}
}