W
W
Way2017-03-19 21:19:39
Java
Way, 2017-03-19 21:19:39

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

2 answer(s)
R
Rou1997, 2017-03-19
@YouTy6bl4

Where do you expect to see him? Telepathy is not yet supported in Java. :)

E
Eugene Khrustalev, 2017-03-19
@eugenehr

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 question

Ask a Question

731 491 924 answers to any question