Reputation: 87
In my JavaFX application I am trying to format a String and then push it to TextField.
This is my code:
String result = "No of Rows Returned : " + repairHeaderEntities.size();
if(null!=repairHeaderEntities && repairHeaderEntities.size()>0){
result = result + "\n" + "\nRepair Status Code: "+entity.getRepairStatusCode();
analyzeResult.setText(result);
analyzeResult is the TextField fx id.
But in the output I am getting the following:
No of Rows Returned : 1Repair Status Code: ENDE
As you can see there output is not moving to a new line and is coming up in the same line.
Upvotes: 0
Views: 718
Reputation: 209330
From the documentation for TextField
:
Text input component that allows a user to enter a single line of unformatted text. Unlike in previous releases of JavaFX, support for multi-line input is not available as part of the
TextField
control, however this is the sole-purpose of theTextArea
control.
Use a TextArea
in place of the TextField
.
If you do not want the user to be able to edit the text in the text control, you could also consider using a Label
instead.
Upvotes: 1