What version of JavaFX? Would you mind creating a bug for this?
Other responses in-line.
On 10/15/14, 6:38 AM, Werner Lehmann wrote:
Hi David,
classpath-relative URLs in CSS do not seem to work, unfortunately. For
example,
-fx-background-image: url("/mint/report_16x16.png");
has no effect. Relative addressing does work. Looks to me as if there
is a bug in com.sun.javafx.css.converters.URLConverter.resolve.
Basically it seems to work like this:
- if url is absolute (has a scheme, e.g. http), use it verbatim
- if stylesheet url is present, use that to resolve the image url
- otherwise go to contextclassloader
I don't get to the last step because the stylesheet url in the second
step is always present. Am I seeing things, or is there another way to
do this?
Two pieces of information are passed into the converter. The first is
the value that was given in the style, e.g., "/mint/report_16x16.png".
The second is the URL of the stylesheet as determined when the
stylesheet is loaded. The stylesheet URL may be null, as would be the
case for an in-line style.
By the way, even with relative addressing I still cannot access images
during debugging in Eclipse if the stylesheet is in a different
Eclipse project than the referenced image resource. This really hurts
modularization and resource reuse (or I am forced to do this in code).
Any idea about that?
If the resource is copied over to the build directory that eclipse uses
on the class-path, then there shouldn't be a problem.
Rgds
Werner
On 01.06.2012 04:03, David Grieve wrote:
In the current implementation, absolute paths without a scheme are
not resolved relative to the class path. I have created RT-21967 to
track the issue.