• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to use TextFlow from FXML?  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use TextFlow coming from FXML but no text is shown.

I have tried:

textflow.getChildren.add(text);

and also:

textflow=new TextFlow(text);

where text is:

Text text=new Text("AAA");

I both cases TextFlow shows nothing.

Is there another container for use with rich text using FXML JavaFX app?

For sure if I try both cases in non-FXML JavaFX app it works both of them.
 
Saloon Keeper
Posts: 10224
216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JavaFX forum.
 
Ranch Hand
Posts: 374
24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please follow JavaRanch policy when posting to multiple forums:
http://www.coderanch.com/t/660346/Wiki/Forthright-Cross-Posting-Sites
https://community.oracle.com/thread/3933717
 
Petr Omáčka
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Example

FXML

>

Controller



Main Class

 
Petr Omáčka
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is also crossposted here http://stackoverflow.com/questions/37436595/how-to-use-textflow-from-fxml.
 
John Damien Smith
Ranch Hand
Posts: 374
24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
User Khaled SAB solved your problem on StackOverflow: http://stackoverflow.com/a/37437608/1155209

In your controller class inside the initialize method you are loosing the reference to the old txtF object declared in your FXML by instantiating a new TextFlow object with the same name, and you are not adding this new object to your AnchorPane. So you'll need to remove this line txtF=new TextFlow(new Text("aaa"));

 
Petr Omáčka
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

John Damien Smith wrote:User Khaled SAB solved your problem on StackOverflow: http://stackoverflow.com/a/37437608/1155209

In your controller class inside the initialize method you are loosing the reference to the old txtF object declared in your FXML by instantiating a new TextFlow object with the same name, and you are not adding this new object to your AnchorPane. So you'll need to remove this line txtF=new TextFlow(new Text("aaa"));



Yes, he does.
 
A teeny tiny vulgar attempt to get you to buy our stuff
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!