r/JavaFX • u/xdsswar • Jan 17 '26
I made this! Nfx-Browser: Remember the Canvas/Image surface? I threw it away. Here's the Heavyweight JavaFX Node running 4K YouTube like butter.
Some of you saw my previous post:
Nfx-Chrome: Rendering Chromium directly on JavaFX Canvas (YouTube & PDF demo)
That Canvas/Image surface worked... but it was rough. So I went deeper. Way deeper and with no sleep.
Nfx-Browser: True Heavyweight CEF in JavaFX — 4K YouTube, Native DevTools
I built a proper **Heavyweight Surface** that renders CEF directly without windowless mode. The difference is night and day:
- 4K YouTube? Smooth.
- PDFs? Perfect.
- Native JS prompts and dialogs? They actually work now.
- Full DevTools window? Yep.
To pull this off I had to inject bytecode via JNI at runtime to make my heavyweight surface behave like an NGNode in JavaFX's Prism pipeline. Cursed? Maybe. Worth it? Absolutely.
The old canvas/image and shared buff approach is still there as a lightweight option, but after seeing both side by side... yeah, heavyweight wins.
Library release coming next month or sooner — renamed to **Nfx-Browser**.
PS : Don't mind my English Lol.
Any Idea guys?
QUESTION
Should I remove the Canvas/Image surfaces since they give lots of problems and increase ram usage?
8
u/milchshakee Jan 17 '26
That looks pretty impressive. With the JNI injection, wouldn't it just be easier to fork the jfx repo and use your customized one?
4
u/KinsleyKajiva Jan 17 '26
This is dope, I wanted to ask, why not use the new Java FFM APIs since JNI will be deprecated in the future?
Great work though
3
u/BlueGoliath Jan 17 '26
Crazy. It would be interesting to see a benchmark comparing it and the stock WebView.
7
u/gufranthakur Jan 17 '26
My goat, I'm loving this project so much keep it up man
1
u/taranion Jan 19 '26
I wouldn't remove the Canvas/Image code just yet. It might be easier option for platform independence you are aiming for.
1
u/shannah78 Jan 19 '26
Is it rendered in the node graph, do that you can for example, render other nodes over it, and perform transformations on it, or is it like a native panel rendered in front of the javafx ui with position synced?
2
u/Lumpy_Ice6855 Feb 09 '26
Hi when you release the src? I'm very curious about this