Answer the question
In order to leave comments, you need to log in
How to draw an image from the internet?
Good evening! I am making an output to the program of images from the Internet, but for some reason unknown to me, the image is not drawn, I will forgive help in solving this problem.
The code:
//Картинка, если нужна \/
//String url = "http://www.malinalife.ru/userfiles/picbig/img2011103101191458.jpg";
URL rl = null;
try {
rl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try
{
BufferedImage image = ImageIO.read(rl);
Graphics graphics = image.createGraphics();
graphics.drawImage(image, 0, 0, 64, 64, null);
graphics.dispose();
} catch (IOException e) {
e.printStackTrace();
}
Answer the question
In order to leave comments, you need to log in
Where do you expect to see him? Telepathy is not yet supported in Java. :)
The picture is drawn in the image object, the image itself is not connected to anything
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question