Source Code : Create Image Icon from PNG file

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Create Image Icon from PNG file

     
import java.awt.BorderLayout;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class PngIcon{

  public PngIcon(){
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton bt = new JButton(new ImageIcon("dtmail.png"));
    JLabel lab = new JLabel(new ImageIcon("dtterm.png"));
    bt.setFocusPainted(false);

    frame.add(bt, BorderLayout.NORTH);
    frame.add(lab, BorderLayout.SOUTH);
    frame.setBounds(50, 50, 200, 200);
    frame.setVisible(true);
  }

  public static void main(String[] args){
    new PngIcon();
  }
}




           
         
    
    
    
    
  

Thank with us