Discussion:
Support of SVG ImageLoader in JavaFX
René Reiß
2018-11-05 11:03:12 UTC
Permalink
Hi,

In Java 8 I used a SVGImageLoader to support SVGs in css-Files,
something like
-fx-background-image : url("/svg/minusicon.svg");

see also
https://blog.codecentric.de/en/2015/03/adding-custom-image-renderer-javafx-8/

In Java 11 I get an IllegalAccessError

java.lang.IllegalAccessError: superinterface check failed: class
SvgImageLoaderFactory (in unnamed module @0x2a8d6c41) cannot access
class com.sun.javafx.iio.ImageLoaderFactory (in module javafx.graphics)
because module javafx.graphics does not export com.sun.javafx.iio to
unnamed module @0x2a8d6c41

I know, the ImageLoaderFactory is not part of the official JavaFX public
API. But, why not? Why it is no more possible to write an own
ImageLoader? It is planned for the future?

Is there another possibility to support SVGs in JavaFX applications?
Otherwise I have to convert all SVGs to png or jpegs, but this will be a
step backwards for me.

Thanks,
--
René Reiß
Tom Schindl
2018-11-05 12:03:05 UTC
Permalink
You can use a custom URLStreamHandler not?

Tom
Post by René Reiß
Hi,
In Java 8 I used a SVGImageLoader to support SVGs in css-Files,
something like
-fx-background-image : url("/svg/minusicon.svg");
see also
https://blog.codecentric.de/en/2015/03/adding-custom-image-renderer-javafx-8/
In Java 11 I get an IllegalAccessError
java.lang.IllegalAccessError: superinterface check failed: class
class com.sun.javafx.iio.ImageLoaderFactory (in module javafx.graphics)
because module javafx.graphics does not export com.sun.javafx.iio to
I know, the ImageLoaderFactory is not part of the official JavaFX public
API. But, why not? Why it is no more possible to write an own
ImageLoader? It is planned for the future?
Is there another possibility to support SVGs in JavaFX applications?
Otherwise I have to convert all SVGs to png or jpegs, but this will be a
step backwards for me.
Thanks,
--
Tom Schindl, CTO
BestSolution.at EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7. A-6020 Innsbruck
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck
Loading...