file:/img/MetroTileHomepage.png doesn't freak out ...
# tornadofx
a
file:/img/MetroTileHomepage.png doesn't freak out but does not return an image, I guess I'll have to keep playing around with it. I'll let you know what the solution was!
r
Are you trying to load an arbitrary image from the file system or a specific one included with the program?
c
file:// is going to need an absolute path and it can get messy with different platforms. Sometimes you get stuff like file://c/user …
so, usually, you’ll use the class loader to also load in your app’s resources
1
Some classes like Image will offer a shortcut like
new Image(“/images/Logo16.png”, true)
If you want to see your image while you come up to speed with the classpath stuff, just put in a full path to MetroTileHomePage
a
@Ruckus trying to load images from my project!
e
@amanda.hinchman-dominguez If the images are on the classpath, ie. under your src/main/resources folder, you should use an absolute path starting with /. For example, an image in
src/main/resources/images
should be references as
/images/imagename
.
a
I must be formatting the url incorrectly!
It looks like I can't attach a file in a thread, so I'll have to post in the main chat.
e
@amanda.hinchman-dominguez Yes, I've noticed that too, no attachments or code posts in threads. Hope they add that 🙂