I'm using a HBox as a container for a label and a textbox. I'd like for both of them to be vertically centered, but no matter how try that doesn't seem to end up happening:
Here's my current code:
setScene(new Scene(new HBox(10) {
setPadding(new Insets(10, 10, 10, 10))
getChildren.add(new Label("Text to find:") { setAlignment(Pos.CENTER) })
getChildren.add(new TextField() { setMinWidth(300) })
}))
Thanks
Call setAlignment(Pos.CENTER)
on the HBox
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With