001 package market.resource;
002
003 import java.awt.Toolkit;
004 import java.net.URL;
005
006 import javax.swing.JFrame;
007
008 /**
009 * Handles the assignment of the image icon to frames.
010 */
011 public abstract class IconSetter {
012
013 /**
014 * @return the full path to the image icon.
015 */
016 public static URL getIconPath() {
017 MarketResourceManager rm = MarketResourceManager.getMRMInstance();
018 ResourceModuleIcon rmg = new ResourceModuleIcon();
019 return rm.getResource(rmg.getTypeName(), "icon");
020 }
021
022 /**
023 * Sets the image icon as a JFrame's icon.
024 * @param jf the JFrame to which the icon is set.
025 */
026 public static void setIcon(JFrame jf) {
027 jf.setIconImage(Toolkit.getDefaultToolkit().createImage(getIconPath()));
028 }
029 }