hi folks,

No More fear of pointers........


Break the old rhythm.Explore the new horizons.


Be a crew member to the new ship......


get easy solutions to solve ur programming issues



WELCOME TO THE WORLD OF JAVA

Setting an Icon Image

In this section, you will learn how to set an icon for the frame in Java Swing.

This program helps us to set the icon (image) on the title bar of the frame. When you open frame or window the icon situated on the title bar is seen on the taskbar also. For this purposes, various methods as follows has been used:

frame.setIconImage(Toolkit.getDefaultToolkit().getImage("siddu.jpg"));
Above method sets the icon for the frame or window after getting the image using the Image class method named getImage().

frame.getDefaultToolkit():
This is the method of the Toolkit class which gets the default toolkit.

Here is the code of program:
Output:


-Source:roseindia.net

No comments:

Search This Blog