Selasa, 20 Oktober 2009

Tampilkan Gambar dengan Java

import javax.swing.JFrame;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.Container;

class showpicture {

public static void main(String agr[]){
JFrame frame = new JFrame();
ImageIcon icon = new ImageIcon("c.jpg");
JLabel label = new JLabel(icon);
Container contentPane = frame.getContentPane();
contentPane.add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}

tada !!!!----hasilnya---->

0 komentar: