Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101891

Image JavaDoc does not document url relative path behaviour

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 7u6
    • fx2.1
    • javafx

      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.

            msladecek Martin Sládeček
            josmithjfx John Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: