Cargar imagen
hola !
Cual es le codiog para cargar una imagen en una ventana ?
gracias
Gracias
Cual es le codiog para cargar una imagen en una ventana ?
gracias
Gracias
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=
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=