Packages.javax.swing.ImageIcon(‘media:///myImage.png’)
This does not appear to work…any help would be appreciated.
I am trying to load an image from the media library into a Java ImageIcon object.
Thanks in advance
Packages.javax.swing.ImageIcon(‘media:///myImage.png’)
This does not appear to work…any help would be appreciated.
I am trying to load an image from the media library into a Java ImageIcon object.
Thanks in advance
and what do you do with the imageIcon object then inside Servoy? Anyway, the ImageIcon constructor expects a URL object, so you cannot provide a URL as String, I think. It should work if you get a URL like that (Java):
URL url = new URL("media://test.png");
ImageIcon icon = new ImageIcon(url);
Hope this helps
Patrick
In this case I am using it as the tiling image for a matteborder / borderfactory.
This lets me tile images from the media library in a java border…thx
I notice you are using new URL, which would imply you have imported. How do you import from within Servoy?
It’s java.net.URL…
Right, but is it possible to do
import Packages.java.net
new URL?
If so, what is the syntax from within servoy to do the import? I have not had much luck with “import”
it should work just like you tried above
Packages.java.net.URL(“media:…”)