This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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).