If you were going to have a large heavily styled t...
# tornadofx
s
If you were going to have a large heavily styled text area, would TextFlow make sense or would it be easier to do something with WebView? This is for a recipe view. It wouldnt be editable (i plan to have another view for editing).. This would be just nice view of the recipe with title, description, pic, ingredient list etc etc. And then hopefully printable with the same look.
a
The problem with text flow (at least it was at javafx 8) is that you can't select text in it. This is really a problem. I tried to use it for colored logs, but ended up with webview. In 11 webview will enlarge distribution size dramatically, so it still a problem.
c
There's this, but I haven't tried it, so YMMV https://github.com/FXMisc/RichTextFX Appears to be broadly used though.
a
I worked with it before switching to web-view. It is good, but API is rather complicated and it is too heavy for read-only views.
s
@altavir so you would use webview?
c
is the source of the formatted text an actual website? are you thinking of running something like NodeJS on the client side to serve up content to your WebView just for formatting?
s
Yeah i just need something for formatting. Not an actual website.
c
and what does the data look like? will you come up with a BB-like markdown for hinting at the formats?
s
I'm not sure yet. Im brainstorming. It would be the same general look just different data
Html just seems like a good fit
a
The problem with text copying seemed critical at that moment, so I've switched to webview. It is quite convenient, but requires a lot of resources. If the problem with text selection would be solved, I will consider switching to plain text flow.
RichTextFX Is a good solution if you do not have complicated output. In my case I needed to represent tables and I did not manage to do fixed tab stops.
s
Yeah theres probably going to be a picture, some background colors, list with muktiple columns etc
a
In this case webview probably is your solution. The only problem with webview I know (save for 40 MB additional dependency) is inability to load local css/js files. Though it is probably fixed in JavaFX 11
s
Oh yeah not being able to load local is kind of a deal breaker there :(
a
There were some workarounds. And it seems to be fixed: https://bugs.openjdk.java.net/browse/JDK-8136466
c
@altavir that's what i was getting at with the embedded HTTP Server. local files and URLs can be a problem with webapps and their libraries so i've seen apps that also run a NodeJS or a Jetty. Often for help functionality
s
Yeah that would be a bit much for what im trying to do. Ill look into the richtextfx or some combination of things i think. Thanks guys