i want to display a image in my java application. i found a code to download the image from the webserver. what that code do is it takes the image and show it in the jframe.
i want to use a label to show the image or soemthing else. so i can put it in my java application. can someone help me. it shouldnt be JFrame
please help me
here is my code
Image image = null;
try {
URL url = new URL(
"http://www.personal.psu.edu/acr117/blogs/audrey/images/image-2.jpg");
image = ImageIO.read(url);
} catch (IOException e) {
}
// Use a label to display the image
JFrame frame = new JFrame();
JLabel lblimage = new JLabel(new ImageIcon(image));
frame.getContentPane().add(lblimage, BorderLayout.CENTER);
frame.setSize(300, 400);
frame.setVisible(true);
can someone help me