Dear Pals, I followed the tutorial provided in JavaWorld to to Extract an Image from a JAR File But in the middle, I am in problem.
I am seeing the button in the north with image, but the center button is without image and the canvas is totally not displayed. I am expecting the center "Hello" button display an imageicon. My comannd line displays the following jarTest.JarResources@784386 --- ashik 1 and sun.awt.windows.WImage@171afc --- ashik 2 Waiting for your response on where did I miss? :roll:
Ashik Uzzaman Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
I got your code to work with some small modifications... I'm not sure why your second image isn't displaying. Is there anything special about the images you are trying to display? All the images I displayed from the JAR file displayed correctly... make sure file names are correct, and that the image isn't corrupted.
As far as why the canvas isn't showing up... the default size of a Canvas is 0x0, so just change it to something large enough to display the image in the constructor. (Also, it's a bad idea to mix AWT components like Canvas with Swing components... you will run into problems down the road...)
Write once, run anywhere, because there's nowhere to hide! - /. A.C.