ads_header

How To Change Icon Project In Netbeans

How To Change Icon Project In Netbeans



Preview



Hello guys, in this post I will discuss about how to change the icon in "Netbeans" project. If you create an app in Netbeans, by default the icon that appears on the title bar of the form as well as on the taskbar when the program is run is like the picture below


Now, I will show you how to replace the icon with our selected image. Okay, first create a project first then add one JframeForm. Then in the properties of the Design Form, select the Events tab, then find and select windowActivated


if done, import library ImageIcon first.

import javax.swing.ImageIcon;
public class Form1 extends javax.swing.JFrame{  

}





Then enter the following code in event formWindowActivated

private void formWindowActivated(java.awt.event.WindowEvent evt){  
   ImageIcon icon = new ImageIcon("src/logo.png");
   setIconImage(icon.getImage());
}

NOTES :

src/logo.png : location, name and extension of your image.
When done, the program is ready to run and your form icon has changed according to your image

For more details, please watch the video below


Powered by Blogger.