Loading an icon

I have a property that contains a path to an icon. The path is created using the “ImagePathEditor” class and is of the form “Builtin/icons…” How do I find the absolute URL so that I can load the icon into my component using the ImageIcon method?

The BeanInfo class code that allows the user to select the icon is:

addProp("defaultIconPath", "Default Icon", "The default icon if no icon is set", CAT_APPEARANCE, PREFERRED_MASK | BOUND_MASK, ImagePathEditor.class);

I would have thought it should be easy enough for me to find the absolute location by searching my filesystem. Unfortunately, I can’t find it. Your help as always is most appreciated.

I’m also curious if there is an absolute path to the image files. From what I found when I checked this out on my own recently was that all the images are stored in Ignition’s internal database. This means there must be some behind the scenes logic that queries the database for the image and places it in an image icon. But as for how to even access that database… well that’s where I fall short on info.

Well that explains why I can’t find it in the file system. It also makes sense to me that you’d want to implement it this way. Now what’s the magic spell that brings forth the icon?

The three eyed raven came through on this one. The following works:

protected static ImageIcon createImageIcon(String path) { if (path != null) { return new ImageIcon( ImageLoader.getInstance().loadImage(path)); } else { System.err.println("Couldn't find file: " + path); return null; } } :smiley: