RSS

Set Icon in Java Frames

16 Oct

Set the icon image in JFrame – you have to put the following code in to your constructor and change the image path most probably we are using 24 * 24 pixels .png image (here “/images/” is one of my packages)

public void Constuctor(){
    this.setIconImage(new ImageIcon(getClass().getResource("/images/payroll.png")).getImage());
}

Example of Jframe

Set the icon image in JInternalFrame

public void Constuctor(){
     this.setFrameIcon(new ImageIcon(getClass().getResource("/images/Profile-24.png")));
}

Example for JInternalFrame

Advertisements
 
Leave a comment

Posted by on October 16, 2012 in java

 

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: