Thursday, 2 May 2013

Show Icon Instead Of Default Java Icon In .jar

If the application is launched using executable jar , an application icon can be specified for use
in desktop shortcuts and menu items. below is code to set :-


/** Use In MAC **/
Image img = new ImageIcon("Image Path").getImage();// your desired image 
Application app = Application.getApplication();
app.setDockIconImage(img);

/** Use In Window **/
frame.setIconImage(Toolkit.getDefaultToolkit().getImage("Image Path"));// your desired image