Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

java - JAVAFX Text Area is not showing formatted output of the string

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...