In this article we will see two steps for how to set JFrame form icon in GUI using swing (Using Drag & Drop Components In Netbeans IDE) in java.
Step - 1 :
First of all create your project and inside a project create one JFrame Form.
After creating the JFrame form, right click on that and create a
windowOpened event.
To create a WindowOpened event right click on JFrame form then Go to
Events > Windows > WindowsOpened.
Image icon = Toolkit.getDefaultToolkit().getImage("Your image file path");
setIconImage(icon);
Place the above code in your windowOpened event.
Step - 2 :
Go to source tab.
Image icon = Toolkit.getDefaultToolkit().getImage("Your image file path");
setIconImage(icon);
Place above code after initComponents() as shown in the image above.
0 Comments
Enter Your Comment