Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVAFX Text Area is not showing formatted output of the string

Tags:

java

javafx-2

Here scenario is program reads output properly and it is also printing properly in the log file but when displying same output on JAVAFX text area its format is getting changed(Its in tabular format) and its not displaying properly. This is the image of text area Below is the output getting written in log file:

 ****************PR Deploy Summary Report Start****************
 Folder                   Server                   Type                     Failed                  
 010_StyleSheets          10.5.50.195              SS                       0                       
 010_StyleSheets          10.5.50.195              WS                       0                       
 020_XSL                  10.5.50.195              SS                       0                       
 030_XSLT                 10.5.50.195              SS                       0                       
 040_WebTemplates         10.5.50.195              SS                       0                       

 ****************PR Deploy Summary Report****************

Actually when i am copying this from text area and pasting it somewhere else then its agian showing it properly in tabular format.But its not displaying it properly on text area. There is very simple code written for this as below:

DeploymentTaskController.actLogTArea.appendText(UnixBoxTask.summary.toString());

                DeploymentTaskController.actLogTArea.end();

Here "actLogTArea" is the reference of text area, summary is StringBuilder ...can anybody guess what can be the issue here? any solution if somebody has already faced this? it may be possible that image i have placed in question is not visible.

like image 320
Rohan Avatar asked Dec 27 '22 01:12

Rohan


1 Answers

Change the font of textArea to generic monospaced one:

actLogTArea.setStyle("-fx-font-family: monospace");

To change other font properties (and see limitations) refer to JavaFX CSS Reference Guide.

like image 69
Uluk Biy Avatar answered Jan 11 '23 03:01

Uluk Biy