posted 7 years ago
Hi,
I was using the code "image = Toolkit.getDefaultToolkit().getImage(url)" to get the picture image.
But subsequent statemetns imagewidth = image.getWidth() returns -1.
As per the Javadoc: If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.
I know that image = ImageIO.read(url) will fully load the image and get the correct width and height in image.getwidth()
As ImageObserver can track the status of image loading, but I am not sure how to code ImageObserver to do the tracking.
Is there some coding examples on this that I can learn from ?
Thanks.