A simple library to add SVG support to JavaFX, allowing to use SVG graphics just like any other image type.
More details about the project can be found at the codecentric blog: Adding a custom image renderer to JavaFX 8
If you are using maven, just add JavaFxSVG to the dependencies
<dependency> <groupId>de.codecentric.centerdevice</groupId> <artifactId>javafxsvg</artifactId> <version>1.3.0</version> </dependency>
Add this line to your application:
preferably before any JavaFX code is executed. After this, you can use SVG images just as any other Image in your application.
If the JavaFX container does not specify any width or height, the image is
rendered with default dimensions (currently 400x400). To changes this behavior,
DimensionProvider can be passed with the install command:
will try to determine the actual size of the SVG (as specified by
height attributes) and use this as a fallback size.
Currently, SVGs are required to start with either "<svg" or "<?xml" due to some rather static signature matching. As a result, svg might not be displayed when starting with whitespace characters or comment.