?
Solved

How to add a picture from internet in my application

Posted on 2005-04-05
3
Medium Priority
?
174 Views
Last Modified: 2010-03-31
Hiya,

I want to add a picture from a URL in my application, lets say is this one:
http://www.bull.net.au/adam/peckas%20pics/YamahaSuperstar1.jpg
How can I do it? any example?
thank you!!
0
Comment
Question by:ximotur
  • 2
3 Comments
 
LVL 15

Assisted Solution

by:aozarov
aozarov earned 200 total points
ID: 13710617
Toolkit.getDefaultToolkit() .createImage(new URL("http://www.bull.net.au/adam/peckas%20pics/YamahaSuperstar1.jpg"))
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13710650
To draw the image: http://javaalmanac.com/egs/java.awt/DrawImage.html
But have a look at: http://javaalmanac.com/cgi-bin/search/find.pl?words=image
to pick the action you want to take.
0
 
LVL 92

Accepted Solution

by:
objects earned 300 total points
ID: 13712668
create a label to display the image and add that label to your image hierarchy where required.

JLabel label = new JLabel(new ImageIcon(new URL("http://www.bull.net.au/adam/peckas%20pics/YamahaSuperstar1.jpg")));

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question