This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Ok, i have a JLabel on my app window, and i wanna load an image that resides on my harddisk or on the net into this already existing JLabel. i tried to do it like this from inside the main method by it gives me an error.
Any way which provides a URL which points to the image. If the image is on the net (and if it's accessible) then you'll have a URL pointing to it. If it's on the disk, then you can produce a File object which refers to it, and File has a method which produces a URL pointing to the file.
You would use the getResource() method if you knew the image was in your classpath somewhere (e.g. in a jar in the classpath).