Reputation: 49
I am outputting text to a textarea in Java FX but how do I prevent the user from using a scroll bar to navigate to the end of text and stop the text from overflowing? (please see the image below)
Below is the code in my GUI.fxml class
<Tab closable="false" text="Second Link">
<content>
<SplitPane dividerPositions="0.5" prefHeight="160.0" prefWidth="200.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<TextArea fx:id="secondText" layoutX="22.0" layoutY="48.0" prefHeight="511.0" prefWidth="571.0" />
<TextField layoutX="215.0" layoutY="14.0" text=" Original Text" />
</children></AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="363.0" prefWidth="292.0">
<children>
<TextField layoutX="215.0" layoutY="14.0" text=" Summary" />
<TextArea layoutX="16.0" layoutY="48.0" prefHeight="511.0" prefWidth="571.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
</content>
</Tab>
Any help would be greatly appreciated, thanks in advance.
Upvotes: 1
Views: 791
Reputation: 1008
Add wrapText=true
to you TextArea
elements. It will wrap the text to the new line instead of scrolling.
Upvotes: 1