I recently started learning java and am trying to make a simple GUI program that takes in a location of an image and then displays the it.

What would be the best way to do this??

haha i saw that tuturial using google earlier today. However i didnt really understand how the code it gives you works (yes i read the descriptions)

To load an image (which is the part i dont quite get) it gives you the following code:

try {
URL url = new URL(getCodeBase(), "strawberry.jpg");
img = ImageIO.read(url);
} catch (IOException e) {

if the folder the image is in is (C:\Users\General Use\Pictures) and the name of the file is "0118080951" where do these things go in the above code? i thought the C:\Users\General Use\Pictures would go in the URL place but i tried that and it didnt work

Edited 3 Years Ago by happygeek: fixed formatting

This question has already been answered. Start a new discussion instead.