Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Setting the Icon for the frame in Java 
 

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

 

Setting the Icon for the frame in Java

                         

Introduction

Here, you will learn how to set the icon of the frame.

This program is the detailed illustration to set the icon to the frame. Toolkit class has been used to get the image and then the image is used to display as frame icon. Toolkit class is used to bind the various components to particular native toolkit implementations. 

getDefaultToolkit():
This method returns the default toolkit.

getImage(url or filename):
This method retrieves the pixels data of the image which can be either in format of .gif, .jpeg or .png. If the security manager installed then the getImage() method first check whether the specified file name has the permission to use and then retrieves the image in pixels format.

Here is the code of the program : 

import java.awt.*;

public class AwtSetIconOfFrame{
  public static void main(String[] args){
    Frame frame = new Frame("Icon setting for the Awt Frame");
    Image icon = Toolkit.getDefaultToolkit().getImage("icon_confused.gif");
    Label lbl = new Label("Welcome in Roseindia.net Tutorial.",Label.CENTER);
    frame.add(lbl);
    frame.setSize(400,400);
    frame.setIconImage(icon);
    frame.setVisible(true);
  }
}

Download this example.

                         

» View all related tutorials
Related Tags: c class make method sed boolean value ole set oo frame if boo to ram bool argument e il not

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

this is best material i had ever seen.

Posted by jagdish on Monday, 07.16.07 @ 15:21pm | #21379

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.