I am creating small project in JavaFX. I created a TextFlow field to show messages i chat.
It looks good but,
When I add more messages this field does not make ScrollBar like TextArea.
I set max height in SceneBuilder but it does not work.
Is there way to create automatic ScrollBar like in TextArea ?
it may some one comes here and looking for answer after one year of posting that question
the answer is
try to use Scene Builder the one that come with Netbeans just googl it and draw first TextFlow then click right and warp it with ScrollPane
or you can paste this code on you FXML
<ScrollPane fx:id="sp" layoutX="1.0" layoutY="1.0" prefHeight="189.0" prefViewportHeight="148.0" prefViewportWidth="139.0" prefWidth="288.0" AnchorPane.bottomAnchor="66.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0">
<content>
<TextFlow fx:id="pan1" prefHeight="193.0" prefWidth="276.0">
</content>
</ScrollPane>
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