Cargar imagen

Lina
15 de Mayo del 2004
hola !

Cual es le codiog para cargar una imagen en una ventana ?

gracias
Gracias

zero
15 de Mayo del 2004
Saludos!

Creeo que te puede servir utilizar ImageIcon y JLabel. bueno aqui esta un ejemplo:

import javax.swing.*;

public class CargaImagen extends JFrame{

public CargaImagen() {

ImageIcon image = new ImageIcon("tu_imagen.jpg");
JLabel label = new JLabel(image);
JScrollPane pane = new JScrollPane(label);

getContentPane().add(pane);

setSize(300,300);
show();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public static void main(String[] args) {

new CargaImagen();
}

}

suerte!

=zero=