// you need a java book. I copy following code from a book
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ImageIconDemo
{
public static void main(String args[])
{
JFrame f = new JFrame("ImageIconDemo"
Container contentPane = f.getContentPane();
//Icon icon = new ImageIcon(".\\icons\\visa.gif"
Icon icon = new ImageIcon("1.jpg"
JLabel label = new JLabel(icon,JLabel.CENTER);
contentPane.add(label);
f.pack();
f.show();
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.