C
Charles Thomas
Here is the code I'm using to retrieve a jpeg image from my Jar Bundler
stand-alone app:
url = getClass().getResource("Images/Splash.jpeg");
if (url != null)
{
splash_image = Toolkit.getDefaultToolkit().getImage(url);
}
What I'm seeing is that splash_image is returned as being valid, but if
I subsequently try to determine its dimensions, e.g.:
do
{
image_width = splash_image.getWidth(null);
image_height = splash_image.getHeight(null);
}
while (image_width == -1 || image_height == -1);
This never returns. So in essence, the image is never actually loaded
from the jar, even though splash_image returns as non-null.
If I declare my canvas as implementing ImageObserver and substitute
"this" for "null" above, I receive an ImageObserver.ABORT followed by an
ImageObserver.ERROR flag when trying to get the width and height of the
image.
Any ideas what I'm doing wrong? The image is in the jar and is fine.
CT
stand-alone app:
url = getClass().getResource("Images/Splash.jpeg");
if (url != null)
{
splash_image = Toolkit.getDefaultToolkit().getImage(url);
}
What I'm seeing is that splash_image is returned as being valid, but if
I subsequently try to determine its dimensions, e.g.:
do
{
image_width = splash_image.getWidth(null);
image_height = splash_image.getHeight(null);
}
while (image_width == -1 || image_height == -1);
This never returns. So in essence, the image is never actually loaded
from the jar, even though splash_image returns as non-null.
If I declare my canvas as implementing ImageObserver and substitute
"this" for "null" above, I receive an ImageObserver.ABORT followed by an
ImageObserver.ERROR flag when trying to get the width and height of the
image.
Any ideas what I'm doing wrong? The image is in the jar and is fine.
CT