Icons on buttons

I have buttons for add/edit/delete in my module with corresponding icons on each instead of text. My png image files were in an image folder in my client src folder.

I was using: Icon add = new ImageIcon(“add.png”);

This was working at one time, but now I have only tiny, empty buttons. The only thing I can think of that changed is upgrading Ignition to 7.3

I tried: ImageIcon add = new ImageIcon(getClass().getResource(“images/add.png”));

But then I get serialization errors due to NullPointerException when I open the window with my module on it.

Any thoughts or suggestions?

It’s unlikely anything changed in 7.3, as all we’re talking about here is fairly standard Java resource locating. However, “fairly standard” doesn’t mean it’s simple, as it tends to depend on things like class loaders, which could change, and could also depend on where you’re running (eclipse vs. real build).

I would recommend this: first, read up about how resource loading works. Here is a good doc page I just found: http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html#getresource

After that, if you’re still having a problem, let us know, and we can look at what you’re doing. I think the main trick is going to be putting the image file in the right place, and making sure to use the right class to load the resource off of.

Regards,