-
Enhancement
-
Resolution: Fixed
-
P4
-
fx2.1
When url is mentioned in the Image JavaDoc ( for example here: http://docs.oracle.com/javafx/2/api/javafx/scene/image/Image.html#Image%28java.lang.String%29 ), it is defined as =>
"Construct an Image which pixels are loaded from the specified url."
The JavaDoc also provides examples such as this one:
// load an image in background, displaying a placeholder while it's loading
// (assuming there's an ImageView node somewhere displaying this image)
Image image1 = new Image("flower.png", true);
However "flower.png" is not a url, but a relative path.
Moreover what this path is relative to is not defined in the documentation.
Testing reveals that (at least in the case of a standalone application), the image is looked up in a path relative to the system property "user.dir". This behaviour was very surprising to me. I would like it better documented.
A related forum discussion is here: https://forums.oracle.com/forums/thread.jspa?threadID=2388109
Additional minor issue is "Construct an Image which pixels are loaded from the specified url." is not grammatically correct.
"Construct an Image which pixels are loaded from the specified url."
The JavaDoc also provides examples such as this one:
// load an image in background, displaying a placeholder while it's loading
// (assuming there's an ImageView node somewhere displaying this image)
Image image1 = new Image("flower.png", true);
However "flower.png" is not a url, but a relative path.
Moreover what this path is relative to is not defined in the documentation.
Testing reveals that (at least in the case of a standalone application), the image is looked up in a path relative to the system property "user.dir". This behaviour was very surprising to me. I would like it better documented.
A related forum discussion is here: https://forums.oracle.com/forums/thread.jspa?threadID=2388109
Additional minor issue is "Construct an Image which pixels are loaded from the specified url." is not grammatically correct.
- relates to
-
JDK-8100633 Image class should recognize a URL beginning with a leading slash as relative to the classpath
-
- Resolved
-