I need to get the path of a Jbutton's icon. Mathod getIcon() gives me an Icon, but inside the Icon interface, I could not find any method that returns the address where the icon is stored.
I am making a simple GUI builder. One of the features is save the design... It basically saves the properties of the components set by the user in a space delimited file. Then I need to retrieve the design from this file once the user opens the design file.
Say for a JButton, I need to know what is the path of the icon that the user selected, so I can recreate a JButton with those preset properties.
Well, I suppose you're gonna have people browsing for images to put on components. You'll have to store the location of those images yourself and persist this info in your file.
On a different point, you say you're holding the component properties in a space delimited file. Are you aware that from JDK1.4 you can persist objects which conform to the JavaBean spec as XML files. The saving and loading work is done for you. Have a look at the java.beans.XMLEncoder and java.beans.XMLDecoder classes.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.