Zayne Zayne - 4 months ago 20
Java Question

How to store the filename of an Icon as a String?

So let's say I have some Icon:

Icon something = new ImageIcon("somefile.png");

And I want to store that
in some Strings. How do I do that?

Obviously I can not do
or cast so I am kind of stumped by what I am sure it has a simple solution.



As you see here :

The filename goes directly to the description-Field what is used in the toString(). Try

String filename = something + "";

What indirectly calls the .toString().